react-oidc-context icon indicating copy to clipboard operation
react-oidc-context copied to clipboard

How to store token in the localStorage instead of sessionStorage?

Open jdavidferreira opened this issue 4 years ago • 2 comments

The token is being stored in the sessionStorage. How can I tell the library to store it in the localStorage?

jdavidferreira avatar Jul 19 '22 20:07 jdavidferreira

I've not tried it myself, but I'm pretty sure that's the userStore prop

const oidc: AuthProviderProps = {
  authority: "http://localhost:5064",
  userStore: new WebStorageStateStore({
    store: localStorage
  }),

dantheother avatar Jul 19 '22 23:07 dantheother

Thanks, it works.

jdavidferreira avatar Jul 20 '22 22:07 jdavidferreira