I am using .net core Identity server4 authenticaltion for my vue js client side app. I have support for multi tenant. I am using oidc client java script library in the client side for authenticaltion.
Client side config will be like this
authority: 'http://identity.identityserver.com/',
"redirect_uri": "http://app.clientapp.com/callback",
"client_id": "app1",
"grant_type": "authorization_code",
"client_secret": "secret_code",
"response_type": "code",
"scope": "openid profile web.api",
"post_logout_redirect_uri": "http://app.clientapp.com/logoutSuccess",
Identity server config will be like this
new Client
{
ClientId = "app1",
ClientName = "Vue JS APP",
ClientSecrets = new List<Secret> { new Secret("secret_code") },
AllowedGrantTypes = GrantTypes.Code,
AllowAccessTokensViaBrowser = true,
AlwaysIncludeUserClaimsInIdToken = true,
AlwaysSendClientClaims = true,
RedirectUris = { "http://app.clientapp.com/callback" },
RequireConsent = false,
PostLogoutRedirectUris = { "http://app.clientapp.com/callback/logoutSuccess" },
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"web.api",
},
},
This works as expected without any issue . It redirect to identity server, login windows pops up and upon entering the credential ,it sucsessfully redirect to the to the http://app.clientapp.com/callback.
My requirement is , based on the user login , i have to redirect to the user to his sub domain, ie is support for the multi tenant. For example , if user "user1" tenant is tenant1 , even though the call back url is configured is http://app.clientapp.com/callback, on sucsessfull redirection ,user has to redirect to the http://tenant1.clientapp.com/callback . I have done the necessery changes in the identity server to override this using the IRedirectUriValidator . And it is redirecting back the http://tenant1.clientapp.com/callback . But issue is, the oidc-client in client side throws "no matching state found in storage" .
Can anyone help on this issue .
Thanks in advance .