Logo-amall

Popping this to top again ... to React Native devs - has anyone else had a problem with refresh tokens getting updated but the JWT being expired on the next query? I'm likely doing something wrong... This thread: https://discord.com/channels/552499021260914688/615892613081333794/1004633806122262559

Last active 7 months ago

7 replies

8 views

  • PK

    Popping this to top again … to React Native devs - has anyone else had a problem with refresh tokens getting updated but the JWT being expired on the next query? I'm likely doing something wrong… This thread: https://discord.com/channels/552499021260914688/615892613081333794/1004633806122262559

  • PK

    Ah! Figured it out. Will provide a little detail shortly for others' benefit.

  • NU

    Omg awesome

  • PK

    Basically: if you use NHost to request GraphQL data, the access token is updated for you. But if you use NHost to do auth but a different package to do fetch then when the access token is changed you need to update the headers on your fetch'ing package too. I'd switched to using mst-gql recently from NHost's GQL requestor and while initially setting the Authorization header, I wasn't updating it when the onTokenChanged event.

  • PK

    Dumb oversight.

  • SV

    @PK this is interesting for me as I struggle with RN logouts as well, how does this log out the user though? It's just that your graphql requests fail?

  • SV

    The nhost authentication shouldn't be logging out the user just because your grapqhl requests have the wrong authentication token - or am I missing something?

Last active 7 months ago

7 replies

8 views