How to get userinfo with Microsoft OAuth after suc

2019-08-09 10:13发布

My applications should login with Microsoft account (OAuth Provider). I got stuck to get user info after successfully authenticated by using following URL https://login.live.com/oauth20_authorize.srf?client_id=CLIENT_ID&scope=SCOPES&response_type=code&redirect_uri=REDIRECT_URL Can any one please help me to get user-info? Is there any library that I need to include for that ? I'm getting authenticated code but I don't know how use ? I'm working with JAVA

2条回答
We Are One
2楼-- · 2019-08-09 10:38

The userinfo endpoint is https://apis.live.net/v5.0/me. Before you call it you need to exchange the code for a token.

查看更多
地球回转人心会变
3楼-- · 2019-08-09 10:59

For anyone stumbling here.

OpenID discovery URL: https://login.live.com/.well-known/openid-configuration

Microsoft doesn't provide userinfo_endpoint in the service configuration json

UserInfo URL : https://graph.microsoft.com/v1.0/me

Make a GET request to this url with header containing access_token that you got after exchanging auth_code

Key: Authorization

Value: Bearer <access_token>

查看更多
登录 后发表回答