- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2019 04:45 PM
I’m currently implementing a rest integration using OAuth2
The resource owner response (for a token) is not processed OOB and there is a slightly tweaked version of OAuthUtil postprocessAccessToken() which resolves the response compatibility issue.
If I trigger authentication via UI action ‘Get OAuth Token’, the access and refresh tokens are renewed and the details updated into ‘oauth_credential’ table. But if I trigger authentication via a script call for oAuthClient.requestToken, the access and refresh tokens are correctly returned but ‘oauth_credential’ is not updated with the new access or refresh tokens (regardless of scope)
So my version of OAuthUtil is functional, otherwise the UI action would not result in populated credentials, but I cannot see why there is no update to ‘oauth_credential’ when authentication is via a script and I haven’t been able to find any information that indicates if this is correct\expected behavior and\or if I need to include additional functions in my script
I can push an update into ‘oauth_credential’ using Glide, but wanted to check first in-case I had missed something.
Should I expect my existing token records in ‘oauth_credential’ to be updated, when I authenticate via a script?
Have I missed something obvious?
Appreciate any thoughts
Tony
My script is simply
var oAuthClient = new sn_auth.GlideOAuthClient();
var params = {grant_type:"password", userStuff, passwordStuff};
var json = new global.JSON();
var text = json.encode(params);
var tokenResponse = oAuthClient.requestToken('myOAuthRecord’, text);
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2019 04:15 PM
Taking another look and following the UI authentication process through, the function required is 'requestTokenByRequest'
Some context can be found here
/nav_to.do?uri=sys_script_include.do?sys_id=b77f2ee28f20020026935f2a37bdeef3
Using this approach, 'oauth_credential' is updated with the new token details.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2019 04:15 PM
Taking another look and following the UI authentication process through, the function required is 'requestTokenByRequest'
Some context can be found here
/nav_to.do?uri=sys_script_include.do?sys_id=b77f2ee28f20020026935f2a37bdeef3
Using this approach, 'oauth_credential' is updated with the new token details.