How to set Authorization token in request headers when user attempts to login on discourse

Hello all,

I am working on integrating my freshly built discourse community with my website. I have also implemented SSO (DiscourseConnect). Everything works fine on Postman.

The problem is I am stuck integrating those.

I can perform authentication in Postman by passing the authentication token in request headers. But I am unable to figure out how to pass the Authentication token in request headers when the user attempts to log in via my discourse website.

In other words, how do I set the Authorization token (present in the browser’s localStorage) in the request headers of the URL that is being sent to my backend?

My tech stack:- React, Django-rest

For a better understanding please take a look at the following:-


In the above request, I am explicitly setting the Authorization token to the request headers.

While integrating, how can I set the token (present in the browser’s localStorage) to request headers while redirecting the request to my backend?

I’m a newbie.