Getting Refresh Token from Salesforce causing invalid_request, scope parameter not supported Error.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 02:29 PM
Hello Service Now experts,
I have a GlideScript/OAuth issue:
I've created an application registry and outbound REST Message for my Salesforce Connected App. I have made a Script in Flow Designer that will use the Access token to fire this message if it's not expired, and if it is expired, it will use the refresh token to get a new access token.
However when I test it, the flow keeps giving me the error message:
Error: User Not Authenticated. Could not retrieve a new access token with the refresh token. invalid_request, scope parameter not supported
I think that the GlideOauthClient is adding the scope parameter after the fact because I haven't explicitly added it to my parameters. Salesforce does not support scope as one of the parameters in their refresh token flow so if Glidescript is adding it for me, it is preventing my from authenticating.
below is the part of the script dealing with the refresh token. I have not added scope but it seems to be adding it somewhere else. Please help as I have been stuck on this problem for 3 days now.
var oAuthClient = new sn_auth.GlideOAuthClient();
var params = {grant_type:"refresh_token", refresh_token: refreshToken, client_id: clientID, client_secret: clientSecret, format: 'json'};
var json = new global.JSON();
var text = json.encode(params);
var tokenResponse = oAuthClient.requestToken(clientName, text);
var token = tokenResponse.getToken();
var access_token = token.getAccessToken();
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2025 07:22 AM
Hello @CameronE
Is this issue is fixed, if yes could you please let me know the resolution steps.