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 ?

redhood
preguntada hace 2 años1193 visualizaciones
1 Respuesta
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

respondido hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas