4
dakkarant
23d

fuck it, im giving my users permanent access tokens, because for some reason using refresh tokens is black magic to the internet -.-

Comments
  • 2
    Afaik, discord does that too. Just hide it.
  • 1
    That sounds like a bad idea. What are you using to manage your tokens?
    Services like Cognito or Auth0 can just do it for you.
  • 0
    @dan-pud keycloak, and i can just get new tokens fine.

    But im also using apollo client(because graphql), and theres nobody talking about how to handle expired keys with that
  • 0
    Wut, how so?
  • 3
    Do it properly, or it'll come back to bite later.
  • 0
    @dakkarant whether you're using rest or graphql the logic should be the same. Request tokens from service. Attach a token to a request, the server checks it, if valid process request, if expired (or not valid) reject request. Client then needs to go back to token service and exchange refresh token then try the request again with the new token.
    Managed services and sdks will do all this for you in background.
  • 0
    @dan-pud yes the whole refreshing thing works, but apollo doesnt have anything build in it seems to retry on a failed request
    (they do but that only triggers on network errors, not graphql errors)
Add Comment