cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3926
Views
0
Helpful
3
Replies

Cisco OAuth SSO - Get User Information

hmubarak
Cisco Employee
Cisco Employee

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 Accepted Solution

Accepted Solutions

I am registering an application in apiconsole.cisco.com

What should be value for "Re-direction URL" when the grand-type Authorization Code is selected. 

View solution in original post

3 Replies 3

hmubarak
Cisco Employee
Cisco Employee

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

 

I am registering an application in apiconsole.cisco.com

What should be value for "Re-direction URL" when the grand-type Authorization Code is selected. 

Just to make sure about the question, redirect URL should be the URL from your website (Webapp URL), it will be redirected after logging-in as below:

your_website_url?code={auth_code_from_sso}

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: