0
votes

I use wso2 identity server to be the key manager of wso2 API-M cluster.

Now user can log in API-M via Google account(OpenID) or Facebook(OAuth2.0) account.

What my question is:

Whatever user log in the system via OAuth2.0 or OpenID, I'll get the token which is verified via identity server.

Now I wanna get the user info (id, from which social service...etc) via their token but I don't know how to do it.

Thanks

Tom

1

1 Answers

3
votes

You can by accessing the userinfo endpoint with the received access token.

The curl command is as follows:

curl -k -H "Authorization: Bearer 4164157d677a6cd3a22e26e24c30135d" https://localhost:9443/oauth2/userinfo?schema=openid

As the response, the WSO2 Identity Server returns a JSON with user claims.

Refer [OpenID Connect Basic Client Profile with WSO2 Identity Server] for more information.