Hi All,
I'm using Script runner to call external Rest API. without Authentication i'm able to connect to External API. Now service has been integrated with ping authentication. i need get the token first before calling the service and pass the received token.
1. Obtain ‘Access Token’ from Ping Federate by passing:
make post request to https://ssodev.example.com/as/token.oauth2
Post should have below name value pair in Header Section
- Header field should have below information:
- Content-Type: application/x-www-form-urlencoded
- Authorization : Basic amlyYXVsdHJhXGY0M1FCbkZIVlp1V1ZTakFnarhwryryZVVmRLaGxUdGE1ZkpYZmdk
- Body field should have below information:
- grant_type:client_credential
2. I will get access token in below format ( for reference )
- {"access_token":" iFjOIxLdW9sjHWpUEjLkccxK3KB8","token_type":"Bearer","expires_in":7200}
3. will Call Ping URL ( using Get/Post/… verb) and include below attributes in its Header section during call :
Authorization: Bearer iWsdfhfghUEjLkccxK3KB8
I need guidance, how to achieve it.
(Note- Only re-generate new access token when get ‘Unauthorised’ error (401 HTTP) - for better performance and to avoid unnecessary network calls.)