How to efficiently retrieve tokens from Cognito while using amplify with react-native ?

0

I am creating an app using Amplify with react-native. For backend, I am using Cognito token for current user using Auth.currentSession(). The issue with this approach is that every time i need to call backend server, I need to call Auth.currentSession(). Is there any other approach I can use apart from increasing token validity ?

1 réponse
0

Hello, thank you for your question. As I understand, you wish to retrieve access tokens from Cognito without needing to continuously call Auth.currentSession(). After the initial Auth.currentSession() call, JWT tokens can be retrieved from your local cache by utilizing the Cache module. Please refer to the link below for examples and additional information.

https://docs.amplify.aws/lib/auth/advanced/q/platform/js/#retrieve-jwt-tokens

répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions