IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

Getting 'Unauthorized' when requesting a token

Open ZahirYounis opened this issue 9 years ago • 22 comments

I am new to this and have read the guide along with doing quite a few tutorials but I'm getting the above token response.

I have used postman, client side requests and a webrequest and all is well (returning a token response), but when I try requesting it from the identitymodel dll, I get the 'Unauthorized' token response.

var disco = await DiscoveryClient.GetAsync("https://identityservertest"); var tokenClient = new TokenClient(disco.TokenEndpoint, clientId, clientSecret); var tokenResponse = await tokenClient.RequestResourceOwnerPasswordAsync(username, password);

I have set up the identity server in a test environment under SSL (using a valid certificate) and to sign the tokens, I've used a self signed certificate. I've also set up CORS so it allows any origin, headers, method and credentials.

The clients haven't been set with 'AllowedCorsOrigins' as I assume if that is left empty, it wouldn't make a difference where the client is connecting from and also the fact it works locally on my machine.

When I look at the log, the idsv doesn't show anything of any significance, only logs when it discovers the idsv. When I run the idsv on my local machine, everything works a treat. I'm sure it's a configuration issue, but any pointers will be much appreciated.

ZahirYounis avatar Jan 31 '17 13:01 ZahirYounis

@ZahirYounis You can use my answer at stack overflow https://stackoverflow.com/a/46364226/2047788

aligin avatar Sep 22 '17 12:09 aligin

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.

lock[bot] avatar Jan 14 '20 07:01 lock[bot]