Ask for how to get user profile after callback

Hello,

My application is using Single Sign On (SSO) Service from IBM Bluemix. This is the credentials info of my SSO Service:

{
“SingleSignOn”: [
{
“credentials”: {
“secret”: “HKROXXXxXX”,
“tokenEndpointUrl”: “https://adminwebsso-jjjfvxi6wy-cq17.iam.ibmcloud.com/idaas/oidc/endpoint/default/token”,
“authorizationEndpointUrl”: “https://adminwebsso-jjjfvxi6wy-cq17.iam.ibmcloud.com/idaas/oidc/endpoint/default/authorize”,
“issuerIdentifier”: “adminwebsso-jjjfvxi6wy-cq17.iam.ibmcloud.com”,
“clientId”: “YgFC7XXXXX”,
“serverSupportedScope”: [
“openid”
]
},
“syslog_drain_url”: null,
“volume_mounts”: [],
“label”: “SingleSignOn”,
“provider”: null,
“plan”: “professional”,
“name”: “VA-Admin-Console-R1-SSO”,
“tags”: [
“security”,
“ibm_created”,
“ibm_dedicated_public”
]
}
]
}

From my Application, I redirect to Login page of IBM like URL:

– https://adminwebsso-jjjfvxi6wy-cq17.iam.ibmcloud.com/idaas/oidc/endpoint/default/authorize?response_type=code&client_id=YgFC7XXXXX&redirect_uri=http://localhost/callback&scope=openid%20openid

In my Call Back function, I can get parameter “code” from callback URL (http://localhost/callback?scope=openid&code=bngM6aV5cYHAvhv7wLAM5QSWFDARn7).

From there, I want to to get user profile. I have try to use AJAX to get user profile:

var settings = {
“async”: true,
“crossDomain”: true,
“url”: “https://idaas.ng.bluemix.net/sps/oauth20sp/oauth20/token”,
“method”: “POST”,
“headers”: {
“content-type”: “application/x-www-form-urlencoded”,
“authorization”: “Basic RXhhbXBsZV9BcHBJRDpWUFlndEdXRlRvYVpZSUNTRzhJeVZFV000bUZicGpsU2t4RlRRbzlySkRGZDdzckc=”,
“cache-control”: “no-cache”
},
“data”: {
“client_secret”: “HKROXXXxXX”,
“grant_type”: “authorization_code”,
“redirect_uri”: “http://localhost/callback”,
“code”: “bngM6aV5cYHAvhv7wLAM5QSWFDARn7”,
“client_id”: “YgFC7XXXXX”
}
}

$.ajax(settings).done(function (response) {
console.log(response);
});

From ajax post above, I have tried to use the “code” from callback, but I’ve got an error message:

– 500 Error: Failed to establish a backside connection

I’ve got stuck here and don’t know how to get user profile from SSO. Please help me.

Related:

Leave a Reply