IdentityServer External auth provider - auth-callback - Redirection - 400 Bad request

前端 未结 4 1257
孤独总比滥情好
孤独总比滥情好 2021-02-05 22:30

I am following https://www.scottbrady91.com/Angular/SPA-Authentiction-using-OpenID-Connect-Angular-CLI-and-oidc-client and https://www.scottbrady91.com/Angular/Migrating-oidc-c

4条回答
  •  悲哀的现实
    2021-02-05 22:48

    Just try with few fixes. First - RedirectUris seems suspicious, since it contains more than one value, - according to the http://docs.identityserver.io/en/latest/topics/clients.html - declaring this as a List could be the source of the issues.

    Next, following the example of server side config https://github.com/IdentityServer/IdentityServer4.Demo/blob/master/src/IdentityServer4Demo/Config.cs

        new Client
        {
           ...
            RequireClientSecret = false,
            RequireConsent = false,
    
            AllowedGrantTypes = GrantTypes.Code,
            AllowedScopes = { "openid", "profile", "email", "api" },
    
            AllowOfflineAccess = true,
            RefreshTokenUsage = TokenUsage.ReUse
    
        }
    

    Let's assume that AllowedScopes should include mandatory email scope, then GetIdentityResources() needs last fix:

        public static IEnumerable GetIdentityResources()
        {
            return new List
            {
                new IdentityResources.OpenId(),
                new IdentityResources.Profile(),
                new IdentityResources.Email(),
            };
        }
    

    Since SPA code is out of scope here, for proper flow implementation please follow the examples:

    https://github.com/IdentityServer/IdentityServer4.Demo/,

提交回复
热议问题