Search code examples
c#jwtasp.net-identityidentityserver4access-token

Calling UserInfo endpoint - IdentityServer4


I am wanting to call the UserInfo endpoint, I read this document on UserInfo Endpoint... I noticed that you would just call it by /connect/userinfo. So when I am running the identity project, I type in the browser https://localhost:5443/.well-known/openid-configuration then I see the userinfo_endpoint.

enter image description here

but when I click on it the browser redirects me to a page saying 401

enter image description here

I am assuming its because I need to create a bearer token to allow me access to view it, correct? If I am correct, would I have to implement this inside of the Identity project, or API project, or MVC project? (I have three projects for this). Is there any documentation/tutorials on how I would go about getting the userinfo_endpoint?


Solution

  • The user info endpoint returns information about a user, so you need some kind of credentials to identify yourself, so that the server knows information about which user it should return. You need an access token to do that. To get an access token you need to perform an OAuth authorization flow. If you have your identity server available online you can use OAuth.tools to perform an OAuth flow. If your server is only on localhost you can still use OAuth.tools to build authorization request and token request (and then use your browser and curl to run them).