How to Send JWT in Request Header when using Basic Authentication in Dash (Flask)

Viewed 170

I am writing a Dash app that requires the user to login using Basic Authentication. The user credentials are then sent to the server in the request header with every request.

What I would rather happen is that a JWT is produced on the client-side and sent in the request header (replacing the basic auth credentials in the request header) as it is much more secure. However, I am having trouble working out how to replace the request authorization headers in Dash.

The flow would be:

  1. User inputs their credentials;
  2. Credentials are used on client-side to grab JWT;
  3. JWT is sent in request header with each request.

To be precise, I am unsure how to carry out step 3 above in Dash.

I am currently using dash-auth for my basic authentication, Python 3.9, Dash 2.0.0.

0 Answers
Related