Cognito User Pool: How to refresh Access Token Android

后端 未结 1 414
悲&欢浪女
悲&欢浪女 2021-01-13 17:21

How do you refresh the access token using Cognito for Android? The documentation suggest the following (https://docs.aws.amazon.com/cognito/latest/developerguide/using-amazo

相关标签:
1条回答
  • 2021-01-13 17:24

    When you call getSession(...) - to get tokens - and if the cached tokens have expired, the SDK will automatically refresh tokens (as long as the refresh token has not expired). If the refresh token too has expired, then getAuthenticationDetails(...) is invoked because now the user credentials (username, password, etc) are required to get new set of tokens. It should not matter how you get the user object, i.e. through getCurrentUser() or getUser(...) methods, as long as there are valid cached tokens or if the tokens can be refreshed, you will get valid tokens with getSession(...).

    Retry with the latest SDK (ver 2.3.1).

    0 讨论(0)
提交回复
热议问题