UnauthorizedRequest after upgrading to RTM
I have a standalone Identity Server instance with backed database configuration for Stores and Identities by using provided packages (IdentityServer4.EntityFramework and IdentityServer4.AspNetIdentity both in versions 1.0.0).
For this instance I have configured only two clients: on is an Implicit Flow and the other is a ClientCredentials.
The ClientCredentials flow is used to enable users to login locally on the IdentityServer instance. This is the client configuration:
new Client
{
ClientId = "adminClient",
ClientName = "Local Admin client",
AllowedGrantTypes = GrantTypes.ClientCredentials,
EnableLocalLogin = true,
AllowAccessTokensViaBrowser = true,
ClientSecrets = new List<Secret>
{
new Secret("supersecretpassword".Sha256())
},
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
"admin"
}
},
At startup I am configuring the OIDC by using
app.UseOpenIdConnectAuthentication( new OpenIdConnectOptions() {
DisplayName = string.Empty,
AuthenticationScheme = "oidc",
SignInScheme = "Cookies",
Authority = Configuration["Issuer:IssuerUri"],
RequireHttpsMetadata = false,
ClientId = "adminClient",
SaveTokens = true
} );
When I try to login by filling the form username and password fields everything works fine. However if I try to click on the OIDC button which appears on the right side within the external authentication section, I get the error "Unauthorized client".
Some questions:
- Is this setup correct if I want to enable users to login on the Identity server instance to update their profile? Is there a better or more secure way to achieve the same result?
- Should I simple hide the OIDC button from external authentication list or do I need to change something to avoid the "unauthorized client" error?
Thanks a lot!
A client credentials client cannot use an interactive authentication scheme.
Oops... you're right, of course.
Apart from this, could you please share your opinion on the bulleted questions?
Thanks
Check out https://github.com/IdentityServer/IdentityServer4/blob/f24cb9e9c9cd5d034228a267c44452904f3d2e98/src/IdentityServer4/Validation/AuthorizeRequestValidator.cs#L113 to see possible reasons for getting the 'unauthorized client" error
Or simply check the log.
cheers Dominick Baier
On Wed, Jan 11, 2017 at 9:24 AM +0100, "ravetroll" [email protected] wrote:
Check out https://github.com/IdentityServer/IdentityServer4/blob/f24cb9e9c9cd5d034228a267c44452904f3d2e98/src/IdentityServer4/Validation/AuthorizeRequestValidator.cs#L113 to see possible reasons for getting the 'unauthorized client" error
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
Already did it. The problem was related to a missing redirect uri. This was in turn due to the fact that I was using the wrong flow (ClientCredentials) as @leastprivilege said.
I only left open the issue to have an opinion on the setup, and particularly to this question:
Is this setup correct if I want to enable users to login on the Identity server instance to update their profile? Is there a better or more secure way to achieve the same result?
Closing. Thanks
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.