AWS Amplify Auth - 'Remember me' functionality for 'withAuthenticator'

Viewed 1831

By default Amplify Auth stores session information and tokens in localStorage and it is possible to configure it to use sessionStorage to achieve not remembering user's sign in.

Amplify.configure({
 Auth: {
  storage: window.sessionStorage
 }
})

It also would be necessary to use custom authenticator UI as hosted one does not provide such functionality

withAuthenticator(App, true, [
 <SignIn/>  //with 'RememberMe' option
])

My question is it okay to reconfigure Amplify Auth right from <SignIn/> component to use another storage type? And if I do so, how to tell Amplify which storage to check for saved session in case of page reload? Or is there a better way to achieve such functionality?

0 Answers
Related