Identityserver4: Always return to https://www.mywebsite.com/signin-oidc after logined

Created on 3 Nov 2016  路  8Comments  路  Source: IdentityServer/IdentityServer4

I'm working under asp.net core 1.0 (.net framework 4.6.2 ). If this is my first time to login in the identity server, it returns always to https://www.mywebsite.com/signin-oidc page instead of https://www.mywebsite.com/

Here is the code in startup.cs
services.AddIdentity<ApplicationUser, IdentityRole>().AddEntityFrameworkStores<ApplicationDbContext>() .AddDefaultTokenProviders(); //.AddUserClaimsPrincipalFactory(); services.AddMvc() .AddViewLocalization(Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat.Suffix) .AddDataAnnotationsLocalization(); services.AddTransient<IEmailSender, AuthMessageSender>(); services.AddTransient<ISmsSender, AuthMessageSender>(); services.AddOptions(Configuration); services.AddApplicationInsightsLoggerProvider(); services.AddIdentityServer() .SetTemporarySigningCredential() .AddInMemoryStores() .AddInMemoryScopes(Config.GetScopes()) .AddInMemoryClients( Config.GetClients(Configuration["AppSettings:ClientMvcWebappRedirectUri"], Configuration["AppSettings:ClientMvcWebappPostLogoutRedirectUri"], Configuration["AppSettings:ClientReactDriverRedirectUri"], Configuration["AppSettings:ClientReactDriverPostLogoutRedirectUri"])) .AddAspNetIdentity<ApplicationUser>();

Here is my config file
`return new List
{
// OpenID Connect hybrid flow and client credentials client (MVC)
new Client
{
ClientId = "client-mvc-webapp",
ClientName = "client-mvc-webapp",
AllowedGrantTypes = GrantTypes.HybridAndClientCredentials,
RequireConsent = false,
ClientSecrets =
{
new Secret("secret".Sha256())
},
RedirectUris = { redirectUri },
PostLogoutRedirectUris = { postLogoutRedirectUri },

                AllowedScopes =
                {
                    StandardScopes.OpenId.Name,
                    StandardScopes.Profile.Name,
                    StandardScopes.OfflineAccess.Name,
                    StandardScopes.Roles.Name,
                    "api1"
                }
            },
            new Client
            {
                ClientId = "client-mvc-reactapp",
                ClientName = "client-mvc-reactapp",
                AllowedGrantTypes = GrantTypes.HybridAndClientCredentials,
                RequireConsent = false,
                ClientSecrets =
                {
                    new Secret("secret".Sha256())
                },
                RedirectUris = { redirectUriReactDriver },
                PostLogoutRedirectUris = { postLogoutRedirectUriReactDriver },

                AllowedScopes =
                {
                    StandardScopes.OpenId.Name,
                    StandardScopes.Profile.Name,
                    StandardScopes.OfflineAccess.Name,
                    StandardScopes.Roles.Name,
                    "api1"
                }
            }
        };`

Everthing works perfect except the above one

Thanks

Most helpful comment

This is perfectly normal behaviour, your client's openid middleware expects that an external OpenId Connect provider returns with a request to /signin-oidc.

Than the client middleware normally redirects to your app, / by default I gueuss.

All 8 comments

This is perfectly normal behaviour, your client's openid middleware expects that an external OpenId Connect provider returns with a request to /signin-oidc.

Than the client middleware normally redirects to your app, / by default I gueuss.

@khelben it sometimes redirects to /signin-oidc and not to / .

sometimes it works, sometimes not. sometimes it returns to / by default, sometimes it returns to /signin-oidc, sometimes it returns a error page.
you can try with my link www.tudingbus.com if you click on the right-top button, you may encounter the problem....

It works well in dev environment, the issues come from the prod envrionment in azure web app

it is because of my prod website address.... with or without www...

it is because of my prod website address...with or without www...

those are two different websites.

hi @tudinger and @brockallen

I got into the same problem as yours with my azure web app, please let me know how did you resolve this problem.

Thank you

Than the client middleware normally redirects to your app, / by default I gueuss

@khelben , do you know which one?
I've added UseCookieAuthentication and UseOpenIdConnectAuthentication as suggested in https://identityserver4.readthedocs.io/en/release/quickstarts/3_interactive_login.html#creating-an-mvc-client, but after Login it ends with
http://localhost:14453/signin-oidc -page not found

@michael-freidgeim-webjet
You can download the samples here https://github.com/IdentityServer/IdentityServer4.Samples

http://xxxxx:8080/signin-oidc -page not found .... I have the same problem but with IIS and when i run it localhost it works fine. any idea?

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings