I go to a page on a different domain (e.g a local html file) There is a link like this: <a href='http://localhost:5005/dashboard' target='_blank'>link</a>.
If I open this link I go to my page but my login information is gone and I have to login again.
When I check the cookies I see that all are the same except for ss-pid and ss-id. There is a new ss-pid and ss-id.
How can I change this? I don’t want to have my login information gone if I click on a link to my website from another website.
To avoid an external Reverse Proxy you could use the Proxy Feature which will let you proxy requests from a .NET App /path to proxy HTTP Requests to an external .NET App on a different domain.
Alternatively you could use a Bearer Token Auth Provider like JWT Auth Provider or API Key Auth Provider where you can specify the authenticated JWT in a Service Client’s client.bearerToken to make Authenticated Requests to different domains.
Hi,
Thank you for your reply. The fact is that I am still on one domain. The link is only on another domain but that shouldn’t matter - it is just a link.
I put up an example here: https://www.meesterklaas.nl/restfiles/temp/test.html
this is just a static html page. It has a link to another website wozzol.nl. If you are logged in on Wozzol and if you click on the link on the html page again you are logged out on wozzol.nl. Very strange.
It works good on your account.servicestack.net. I’ll try to create a reproducable demo tomorrow.
It’s because your test page is on a different domain so when you navigate to it from a different domain it doesn’t include any of the existing cookies for that domain which forces ServiceStack to re-create missing session cookies.
I would move that page to a page under https://www.wozzol.nl/ so any links to itself will include the existing cookies.
You can also try relaxing the same-site cookies behavior, e.g:
SetConfig(new HostConfig {
// Configure cookies to use SameSite=[null:Lax,true:Strict,false:None]
UseSameSiteCookies = false
});
Ah, that was what I was searching for. I had UseSameSiteCookies set to true for some reason. After changing it to null everything worked as I wanted it to. Thank you again!