adam-hanna / jwt-auth

This package provides json web token (jwt) middleware for goLang http servers
MIT License
232 stars 43 forks source link

Tokens in Context #15

Open areYouLazy opened 3 years ago

areYouLazy commented 3 years ago

It would be useful to have AuthToken, RefreshToken, X-Csrf-Token and expiration in the request.Context(). This is useful if you need to send tokens in request body or do something else with tokens

    authTokenString := jwtauth.GetAuthTokenFromContext(r.Context())
    refreshTokenString := jwtauth.GetRefreshTokenFromContext(r.Context())
    csrfTokenString := jwtauth.GetCSRFTokenFromContext(r.Context())

    // do stuffs with tokens
adam-hanna commented 3 years ago

Agreed. I'll look into it.

Thanks