Custom header from remote site

I have a custom header on my remote django site that renders some information so I decided to make a view for it and use an ajax request to load it into my discourse header when the page loads and it renders everything I need…

It worked beautifully except that since the request is coming from discourse and not the browser os the user, it is not showing that I am logged in in my custom header. (I am using sso, working fine, discourse avatar showing, and logged in, only my custom header links are showing as if I am not logged in on my main site)

How could I fix this? Is there a way I can make the ajax request come from the browser so it would be the actual request user and my site would show them as logged in?

or should I go a different route and send some of the user info along with the request to authenticate them?

for an example here is the jquery that gets the header menu:

<script>

    $(document).ready(function() {
        $.get( "https://my-domain.com/discourse/get-menu", function( data ) {
            $("#LLmenu").html( data );
        });
    })
</script>

I had the cause wrong, it was due to not including credentials in a CORS request, solved by using ajax and including the credentials

4 Likes