Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass JSON web token (JWT) to a get request

Tags:

python

jwt

I'm using the PyJWT library (import jwt) library to generate JSON web tokens for authentication.

The original design had us passing the token in through the URL like http://example.net?token=eyKDFkdfkdndfndfk...

However, with this solution it appears like anybody who views the token in the URL could then use this token to access the site.

Is the proper solution to pass the JWT through the HTTP header and through SSL? It looks like some solutions pass the JWT through "Authorization Bearer" such as in this thread: Best HTTP Authorization header type for JWT

like image 269
William Ross Avatar asked Sep 20 '17 13:09

William Ross


People also ask

Can we send JWT token in GET request?

Use authorization headers for your JWT bearer tokens. Note: JWT is simply a standardized way of sending information between parties, and it is possible that you could safely send a JWT via a URL in other scenarios (e.g. single-use tokens), but it is not something we recommend in the context of Auth0.

How do I get an API with JWT token?

To authenticate a user, a client application must send a JSON Web Token (JWT) in the authorization header of the HTTP request to your backend API. API Gateway validates the token on behalf of your API, so you don't have to add any code in your API to process the authentication.

How do I transfer my JWT tokens to frontend?

In your frontend, store the access token in memory of your client's JavaScript application and store the refresh token in a web store. Send JWT access token as a bearer in HTTP header with each server request that requires authorization. Verify the JWT on your server using the public key (public to your services).


1 Answers

You can pass jwt token in auth header as depicted here. get request with jwt

like image 145
Chirag Vora Avatar answered Oct 21 '22 01:10

Chirag Vora