NET Core 3 Preview 8升级后反应SPA / Embedded Identity Server问题

And*_*ffy 12 c# node.js reactjs asp.net-core identityserver4

我们有一个React SPA,它最初是使用SPA模板创建的,并在.NET Core 3预览版7上运行。ReactSPA“客户端”已配置为隐式流,并成功使用了oidc-client。一切正常。

这是我的startup.cs中的客户端配置:

        var mySPAClient = new IdentityServer4.Models.Client()
        {
            AccessTokenLifetime = accessTokenLifetime,
            RedirectUris =
                {
                    $"{host}/authentication/login-callback",
                    $"{host}/silent-refresh.html"
                },
            PostLogoutRedirectUris =
                {
                    $"{host}/authentication/logout-callback"
                },
            ClientId = "projectName.web",
            AllowedScopes =
                {
                    "projectName.webAPI",
                    "openid",
                    "profile"
                },
            ClientName = "projectName.web",
            RequireConsent = false,
            AllowedGrantTypes =
                {
                    IdentityModel.OidcConstants.GrantTypes.Implicit
                },
            AllowAccessTokensViaBrowser = true,
        };
Run Code Online (Sandbox Code Playgroud)

但是现在当我升级到任何预览版本为7的程序集的预览版本8时,日志中都会出现以下错误

[10:55:34错误] 客户端的无效授权类型:“ authorization_code” AuthorizeRequestValidationLog {ClientId:“ projectName.web”,ClientName:“ projectName.web”,RedirectUri:“ https:// localhost:44343 / authentication / login-回调 “,AllowedRedirectUris:[” https:// localhost:44343 / authentication / login-callback “,” https:// localhost:44343 / silent-refresh.html“],SubjectId:”匿名“,ResponseType:”代码“,ResponseMode:”查询“,GrantType:” authorization_code“,RequestedScopes:”“,状态:” a1e84334a8c94b7db599ddb9336447c8“,UiLocales:null,Nonce:null,AuthenticationContextReferenceClasses:null, DisplayMode:null,PromptMode:null,MaxAge:null,LoginHint:null,SessionId:null,Raw:[(“ client_id”:“ projectName.web”),(“ redirect_uri”:“ https:// localhost:44343 / authentication /登录回调“),(” response_type“:” code“),(” scope“:” projectName.webAPI openid配置文件“),(” state“:” a1e84334a8c94b7db599ddb9336447c8“),(” code_challenge“:” E8p1sg1Y0TdbhxccGB-_fbx7DC “” code_challenge_method“:” S256“),(”提示“:”无“)]}(IdentityServer4.Validation.AuthorizeRequestValidator)[10:55:34错误]请求验证失败(IdentityServer4.Endpoints.AuthorizeEndpoint)

我不知道为什么它现在指的是authorization_code,并且出现此错误?

为任何帮助欢呼

Ton*_*Ngo 1

将 the 改为response_typebe"token"而不是"code"你应该没问题

更新:

确保您提供正确的authority, client_id, response_type, scope设置