11-22-2019 07:31 AM - edited 11-22-2019 08:47 AM
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:
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.
Solved! Go to Solution.
06-11-2020 03:13 AM
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.
11-22-2019 01:24 PM
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:
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
06-11-2020 03:13 AM
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.
06-11-2020 01:51 PM - edited 06-11-2020 01:56 PM
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}
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide