Identityserver4: Sorry, there was an error : unauthorized_client

Created on 25 Jan 2019  路  5Comments  路  Source: IdentityServer/IdentityServer4

Hi,
I have implemented an angular 7 client which consumes the Identity Server 4. When running the client in localhost, its working fine. But when I deploy it in Dev environment, its giving me a "unauthorized_client" error.

Here is the client configuration in Identity Server 4:

new Client
{
ClientId = "client_angular",
ClientName = "UserApp",
AllowedGrantTypes = IdentityServer4.Models.GrantTypes.Implicit,

            AllowedScopes =
            {
                IdentityServerConstants.StandardScopes.OpenId,
                IdentityServerConstants.StandardScopes.Profile,
                IdentityServerConstants.StandardScopes.Email,
                "helpdesk_service_api.read",
                "helpdesk_service_api.write"
            },

            RedirectUris = {"http://client-url/auth-callback"}, 
            PostLogoutRedirectUris = {"http://client-url"}, 
            AllowedCorsOrigins = {"http://client-url"}, 

            AllowAccessTokensViaBrowser = true,
            AccessTokenLifetime= 3600,
             RequireClientSecret = false,

        }

And on the angular client side, this is how its configured:

export function getClientSettings(): UserManagerSettings {
return {
authority: 'http://identity-server-url',
client_id: 'client_angular',
redirect_uri: 'http://client-url/auth-callback',
post_logout_redirect_uri: 'http://client-url',
response_type:"id_token token",
scope:"openid profile email helpdesk_service_api.read helpdesk_service_api.write",
filterProtocolClaims: true,
loadUserInfo: true,
automaticSilentRenew: true,
silent_redirect_uri: 'http://client-url/silent-refresh.html',
};
}

Is there anything missing?

question

Most helpful comment

Just fond out that there is a discrepancy between the redirect url in the client and the one in IS. IS didnt run the seeding with the new one.

All 5 comments

Is there anything missing?

check the logs

The logs didnt output any error.

If IS issues an unauthorized client error, there will be an error entry in the log.

Just fond out that there is a discrepancy between the redirect url in the client and the one in IS. IS didnt run the seeding with the new one.

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