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.

Were you able to find a solution for this? I have the same exact problem.

Hi @Ankit_Kumar_Jha, I found a way to do it.
I have set-up the discourse-connect url in dashboard settings to the frontend url of my main site.

Let’s say is my frontend site and is my discourse site. I have set-up the discourse connect url to something like From this frontend site URL i am sending a request to my backend API endpoint. In this request i am storing the authorization token in headers.


1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.