I have an IDP server implemented by Duende IdentityServer assume which is hosted on idp.com
and there are two separate ReactJS applications hosted on app.mysite.com
and profile.mysite.com
and they are using JWT token for authentication and authorization process. now when I login into app.mysite.com
through idp.com
profile.mysite.com
is un unauthenticated and needs another login. I use the same client configuration for both of these sites. I know there are some methods such as using an IFRAME inside client code to share the JWT token between these two app but I am looking for a built-in approach inside the Identity server to solve this issue?
How to Authenticate two subdomain by one login in IdentityServer?
1k Views Asked by Navid_pdp11 At
1
First of all, if you have 2 CLIENTS, you should configure 2 separate configurations for both of them.
Afer separation of clients you should rely on cookie set on
idp.com
after first authentication. (Good to know - How to setup cookie authentication basic cookie authentication: https://learn.microsoft.com/pl-pl/aspnet/core/security/authentication/cookie?view=aspnetcore-6.0)Anyway, if you configured IdentityServer properly, it handles cookie authentication "out-of-the-box" - so probably the only thing you have to do is to Signin the user.
When the youser want to login to second application, after start of the flow (eg. code flow) and redirect to the
idp.com
,idp.com
knows that the user is already signed-in (cookie) and should immediately generate token and redirect back to the return url.If you need you can adjust custom behaviours using
IProfileService
.