How to keep user logged in react-native using aws amplify

Question:

I have already done getting the user from aws cognito and how can I do it properly to keep the user logged in even when the react native app is closed

Answer:

If you’re using the Auth API provided from Amplify, once you use Auth.signIn, that API will manage your session state.

In your main entry component (probably App.js) check in the componentDidMount() method what Auth.currentAuthenticatedUser() will return before and after you’ve signed in with a valid user.

Leave a Reply