简体   繁体   中英

How to get user's profile in wso2 api manager?

I need get user's profile in wso2 api manager, how could i do that? Until now, i've done get access token, refresh token and revoke token:

https://localhost:9443/oauth2/token --> access and refresh token
https://localhost:9443/oauth2/revoke --> revoke token

Thanks for help me.

if you define openid as one of the scope, then you would be able to use userinfo endpoint to get the user related info.

Generate token with scope openid

curl -k -d "grant_type=password&username=admin&password=admin&scope=openid" -H "Authorization: Basic NzhfQURZNGdBMWJ6djd0ZVc0Zk11VkpMM0xVYTpQWE55RmZ1ZjlmbkVhUW9NYksyaUxjTFE1dndh" https://localhost:9443/oauth2/token

use that token to request userinfo

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

by default, response would only contain the sub value. {"sub":"admin@carbon.super"}

You can define which parameters you should send by configuring the claims in the service provide application in API Manager

for that log in to carbon management console and select the service provider application

under the claim configuration you can set email, lastname, and any other claims you need as 'Requested claims'

ex: http://wso2.org/claims/emailaddress for email

once configured, you would get following kind of response for previous request

{"sub":"admin@carbon.super","family_name":"adhikarinayake","email":"chamilaa@wso2.com"}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM