Mobile Cognito signin - ios

I am using Cognito to signup/signin users from my iOS swift Mobile App. It seems that after login, a temporary token is provided. Until the token expires, the user does not need to signin when he relaunches it.
My use case is that I always want my users to sign in when they launch the app. Does anyone knows how to customise Cognito for this kind of behaviour ?
I do not want to force log out when the users kill the app, because there are several other cases for which I won't be able to log out (during crash for instance)

The SDK can clear login state, perhaps you could store a timer for the last time they did sign in? Then when the app spins up, check that timer, and if it's above some threshold you could clear the login state and ask them to sign in again? That could handle a quick close and re-open.

Related

preventing iPhone app users from logging in into multiple devices

I'm creating a book library app, where people buy an account and become able to read all the books...
In the past, we were able to get the UDID of the iOS device and the login only works from this specific UDID.. now apple prevents this, another solutions were there like OPEN-UDID but now doesn't work...
Are there any other means to prevent the user from giving the credentials to another people??
The only solution on top of my head now is this :-
When a user login, a flag on the server becomes true, and when another account try to login using the same credentials, it will show an error message "you are already logged in on another device".. when the original user logs out, the flag becomes false.. this will prevent the account from being used on multiple devices at the same time.. but the drawback is, what if the user unInstalls the app without logging out?
Is there a research on this topic that covers all these scenarios?
Is there a way to use apple keychain or iCloud or any other solution ?
What you can do is on new login invalidate api request(and send them to login screen) of previous login you can use device token with each api to check if you want to send data to device or it's a old login token and needs redirect to login. you have to just store a device token for each account login if it matches then send data else redirect to login
Edit 1:
if you uninstall the app then you have to login again from other device to access the books(data) and in each login you'll replace the old token with new one. Now only device which has this new token can access books. All other device if there are any login left in any device then they will get message from API that token not matched and you have to redirect them to login page again

Amazon Cognito: Once a user is verified do they have to be prompted to sign in?

I'm working with AWS Cognito. I have my sign-up flow working just fine. They user fills out their email addresss and password and I create the account in the proper User Pool. I have email verification enabled, and the email is sent and is received in short order. After the Sign Up screen the user is presented with a verify screen to accept the code that was just emailed. Again, this all works great.
What I am trying to understand is:
Once I have a user signed up and verified, in order for the iOS AWS SDK to do it's thing, so I need to then tell the user to go sign in or am I just missing some call that can grab their credentials once they are verified?
My guess is, since we don't know when the user verified themselves, it could be hours later and they could have killed the app and restarted it in that time that the expected flow is to have them sign in again.
Since the app does have the password in memory (NOT stored anywhere on disk) that they used to sign up in the current signup navigation controller/flow I supposed I could just force the sign-in after the verify completes.
I just wanted to make sure I didn't miss something in the SDK or it's docs about this case.
Your understanding is correct, there is no verification flow that will skip sign-in. One option would be to keep the password they used to sign-up in memory and if they verify immediately use that. If they come back some time later or restart the app force them to sign in.

How to know user has already done Facebook login at iOS app

I am developing iOS App which use Facebook iOS SDK 4.
When user has already done Facebook login, by doing Facebook login the dialog which shows "user has already approved your app" had be displayed.
So, do not show the dialog. I want to know whether the user has already done Facebook login.
Anyone know the good way? I think accessToken is returned if user once had done Facebook login.
FBSDKAccessToken manage current logged user's accessToken.
According to official Facebook Login guide
"FBSDKAccessToken Represents the access token provided by a successful login. Most important, it provides a global +currentAccessToken to represent the currently logged in user."
The currentAccessToken is a convenient representation of the token of the current user and is used by other SDK components (like FBSDKLoginManager).
According to above you can check either user has valid accessToken or not and based on this you can track call login method otherwise just skip to next flow.
In Facebook the access tokens are per user so you can pass them around apps and they will work. In your case if you can ship an access token from another app you will be able to skip the next logging in and use the API normally.
However I think this this thread will help you.
Things are a little bit different with iOS cause I have done a facebook login on Android and got no such issues.

iOS Facebook SDK - Manually Expire a Session - Kiosk App

I'm struggling with the darn Facebook SDK.
I'm writing a 'kiosk app' i.e. an App that will have multiple users use it throughout the course of a day - each user can optionally send info unto their Facebook accounts ( and I need to use the Graph API so I can't use ShareKit ), and then I need to get them to manually logout or it will do so automatically after a short timeout.
In either case it MUST forget their credentials and session data, so that when the next user ( even just moments after ) presses the Facebook button it won't try and use the previous users credentials and log automatically into the wrong account.
I'm even manually calling '[facebook logout:self];' and that NEVER does anything.
Please, can anyone help?
Call auth.expireSession on the REST API.
https://developers.facebook.com/docs/reference/rest/auth.expireSession/
I recently had to this for a kiosk app at f8. Nothing exist from the graph API yet to do this.

iPhone app, how to avoid asking the user to re login to facebook

I am integrating my app with FaceBook on iPhone. When the first time user log's in I would like to ask him to enter the FaceBook credentials, but after than whenever he come back to my app I don't him to show the login screen again. So I have two questions
How does this single sign on works? - it says that if the user is already logged into FaceBook through some other app, FaceBook login screen will not be shown to him, so does the FaceBook gives the same access token and expiry time as it has given to the other app or does it create a new access token and a new expiry time?
So after the expiry time, user will be presented the FaceBook login page again? I really don't want this to happen, is this is way to avoid it.
One solution that i can think of this to make a request with the permission for offline_access, in which case the token will never expire, any other solution guys?

Resources