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:-

Response:-
http://discuss.example.com/session/sso_login?sso=bm9uY2U9Y2I2ODI1MWVlZmI1MjExZTU4YzAwZmYxMzk1ZjBjMGImbmFtZT1zYW0mdXNlcm5hbWU9c2Ftc2FtJmVtYWlsPXRlc3QlNDB0ZXN0LmNvbSZleHRlcm5hbF9pZD1oZWxsbzEyMyZyZXF1aXJlX2FjdGl2YXRpb249dHJ1ZQ%3D%3D&sig=3d7e5ac755a87ae3ccf90272644ed2207984db03cf020377c8b92ff51be3abc3

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.