1
votes

I am trying to authorize a react project via IdentityServe.

Sorry, there was an error : invalid_request
Missing openid scope
Request Id: 0HM6DDV35HLDE:00000001

Tell me what could be the reason?It seems that the urls is correct. Most likely the reason is in the config parameters.

Config:

public static IEnumerable<Client> Clients =>new List<Client>
    {
       new Client
         {
            ClientId = "js_oidc",
            ClientName = "Javascript Client",
            AllowedGrantTypes = GrantTypes.Implicit,
            AllowAccessTokensViaBrowser = true,
        
            AbsoluteRefreshTokenLifetime = 200,
            IdentityTokenLifetime = 15,
            AccessTokenLifetime = 100,
            AuthorizationCodeLifetime = 15,
            SlidingRefreshTokenLifetime = 120,
        
            RedirectUris =
            {
                "http://localhost:3000/callback.html",
                "http://localhost:3000/silent.html"
            },
            PostLogoutRedirectUris = { "http://localhost:3000/index.html" },
            AllowedCorsOrigins = { "http://localhost:3000" },
        
            AllowedScopes =
            {
                IdentityServerConstants.StandardScopes.OpenId,
                IdentityServerConstants.StandardScopes.Profile,
                IdentityServerConstants.StandardScopes.Email,
                "api1"
            }
            }
        };

AuthService:

    constructor() {
    const settings = {
        authority: "http://localhost:5001/",
        client_id: "js_oidc",
        redirect_uri: "http://localhost:3000/callback.html",
        silent_redirect_uri: "http://localhost:3000/silent.html",
        post_logout_redirect_uri: "http://localhost:3000/index.html",
        scope: "api1"
    };
    this.userManager = new UserManager(settings);
  }
 
3

3 Answers

1
votes

You must ask for

scope: "openid api1"

in your client, because openid is a required scope when using openid connect.

0
votes
 <script src="oidc-client.min.js"></script>
    <script>
        new Oidc.UserManager({ response_mode: "query" }).signinRedirectCallback().then(function () {
            window.location = "index.html";
        }).catch(function (e) {
            console.error(e);
        });
    </script>
0
votes
callback.html:21 Error: No state in response
    at e.t [as readSigninResponseState] (oidc-client.min.js:1)
    at e.t [as processSigninResponse] (oidc-client.min.js:1)
    at e.t [as _signinEnd] (oidc-client.min.js:47)
    at e.t [as signinRedirectCallback] (oidc-client.min.js:47)
    at callback.html:18