用于NUXT SPA应用程序的OAuth2服务器

时间:2019-06-12 10:43:45

标签: asp.net-core identityserver4

我正在为使用@ Nuxtjs / auth插件的NUXT SPA应用程序创建Oauth2服务器。

当我调用this。$ auth.loginWith(oauth2)时,服务器会记录

IdentityServer4.Validation.ScopeValidator:Error: Requests for token response type only must include resource scopes, but no identity scopes.

我尝试更改范围,但未更改。

客户端的配置如下:

new Client {
      ClientId = "NUXT",
      AllowedGrantTypes = GrantTypes.Implicit,
      AccessTokenType = AccessTokenType.Reference,
      AllowOfflineAccess = true,//Enables refresh token.
      ClientSecrets = {
             new Secret("password".Sha256())
      },
      AllowedScopes = {
             IdentityServerConstants.StandardScopes.OpenId,
             IdentityServerConstants.StandardScopes.Profile
      },
      RedirectUris = {
             "http://localhost:3000",
             "http://localhost:3000/inspire"
      },
      AllowAccessTokensViaBrowser = true
}

在NUXT中,策略的配置如下:

auth: {
    strategies: {
      oauth2: {
        _scheme: 'oauth2',
        authorization_endpoint: 'http://localhost:8000/connect/authorize',
        userinfo_endpoint: 'http://localhost:8000/connect/userinfo',
        scope: ['openid','profile'],
        response_type: 'token',
        token_type: 'Bearer',
        redirect_uri: 'http://localhost:3000/inspire',
        client_id: 'NUXT',
        token_key: 'access_token',
      }
    }
}

我应该如何配置nuxt或身份服务器以便在服务器上进行身份验证? 预先感谢

0 个答案:

没有答案