What is correct approach to refresh id-token via. AWSMobileClient swift?

470 Views Asked by At

I am using aws-cognito UserPool (via. AWSMobileClient) for authentication of users to access the AWS Services. Currently the user may choose to log-in via Phone, Google and Facebook using Hosted UI option, which in return provides the ID-token, Access-token, and Refresh-token. As per the AWS docs, the id-token is valid maximum for 1hour, and the refresh-token automatically updates the id-token(provided refresh token is valid and not expired). To request the new id-token when the initial has been expired, I call :

AWSMobileClient.default().getTokens(<#T##completionHandler: (Tokens?, Error?) -> Void##(Tokens?, Error?) -> Void#>)

This works fine when user is logged in via phone number, and successfully returns me updated ID-token. But if the user is logged in via Social logging method, on calling the said functions brings me the drop-in UI from AWS to sign-in.

How may I stop this behaviour in case of social login?

0

There are 0 best solutions below