简体   繁体   中英

Using Amazon Cognito Identity User Pools

Yesterday I was excited to see the roll out of the new user pools beta. I was able to get the auth working just fine and have no problem signing up a user, signing a user in. However, I am having trouble going from there to allowing persistence. Which comes from storing the login credentials.

In the sample app, the AWSSignInProvider (used for Facebook, Google,Twitter) class extends AWSIdentityProvider. Do I need to build out a separate class for the Cognito User Pool as well that will refresh the token? I cannot find much documentation or examples on this.

Cognito mobile SDKs persist the tokens for you once the user is logged in. The next time you call the getSession method for a user, the SDK will directly return the cached tokens or automatically refresh them for you if there is a valid refresh token.

Only if the refresh token is expired, the user will be asked to enter his username and password. Hope this solves your persistence requirement.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM