cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Community Helping Community

216
Views
0
Helpful
1
Replies
Cisco Employee

Cisco OAuth SSO - Get User Information

Hello,

 

I am very new in using Cisco OAuth 2.0. Currently, I have created a sample app under https://apiconsole.cisco.com/ and I have used client details for OAuth like the following:

https://cloudsso.cisco.com/as/authorization.oauth2?response_type=token&client_id={client_id}&redirect_uri={website_url}

 

After the login process, thre request was redirected successfully as below:

{website_url}/#access_token={token_value}&scope=&state=mystate&token_type=Bearer&expires_in=3599

 

Is there any API (or docs reference), that can be used to retrieve basic user information (like name, email,...) using the token (Bearer authentication) from the URL result?

 

Thanks in advance.

 

1 REPLY 1
Cisco Employee

Re: Cisco OAuth SSO - Get User Information

Yes, I found a way to get user information (but not sure if I can use some other ways)

 

1) Authorization: in this step, an authorization code will be fetched for the created application. So in case of a web page, URL should be redirected to:

  https://cloudsso.cisco.com/as/authorization.oauth2?scope=openid+profile&response_type=code&client_id={client_id}&redirect_uri={website_url}

 

2) After the login done sucessfully, the page will be redirected to website_url with code as a URL parameter. This code will be used to fetch the access token by sending a post request to https://cloudsso.cisco.com/as/token.oauth2 with data below (content type is 'application/x-www-form-urlencoded'):

client_id={client_id}&client_secret={client_secret}&code={code from the first step}&redirect_uri={website_url}&grant_type="authorization_code"

 

The response will contain the access token to be used for API Rest Calls, and this will be used as a part of request headers for the API requests:

Authorization: Bearer {access_token}

 

3) User information can be fetched by sending a GET request with the access token using the following URL:

https://cloudsso.cisco.com/idp/userinfo.openid

 

CreatePlease to create content
Content for Community-Ad
FusionCharts will render here