This script include modifies request parameters and parses the token response during runtime.

If the external OAuth provider returns a response other than an application/JSON type response, you can customize your own version of this script include to parse responses that are in different format. Extend or copy this script include, and then reference your version from the OAuth API Script field on the Application Registry form for third-party OAuth providers. The custom script include name must start with OAuth.

For example, if the OAuth provider requires a resource parameter with value https://outlook.office365.com, the code would look like:
preprocessAccessToken: function(requestParamMap) {  requestParamMap.put("resource", "https://outlook.office365.com");  },

OAuthUtil - getOAuthProfile()

Returns a GlideRecord representing the current OAuth profile

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
GlideRecord GlideRecord representing the current OAuth profile

OAuthUtil - interceptRequestParameters(requestParamMap)

Adds a name:value pair to the request parameters.

Table 3. Parameters
Name Type Description
requestParamMap String The name:value pair you want to add.
Table 4. Returns
Type Description
void

OAuthUtil - parseTokenResponse(accessTokenResponse)

Parses the token received into a parameter map.

Table 5. Parameters
Name Type Description
accessTokenResponse String The access token response that you want to parse.
Table 6. Returns
Type Description
void

OAuthUtil - setEndpoint(url)

Set the endpoiont for your OAuth request

Table 7. Parameters
Name Type Description
url String URL endpoint for your request
Table 8. Returns
Type Description
void

OAuthUtil - setHeader(headerName, headerValue)

Add a header to an outbound token request.

Table 9. Parameters
Name Type Description
headerName String Name of your token request header
headerValue String Value of your token request header
Table 10. Returns
Type Description
void

OAuthUtil - setQueryParameter(paramName, paramValue)

Add a query parameter to an OAuth request.

Table 11. Parameters
Name Type Description
paramName String Name of your parameter
paramValue String Value of your parameter
Table 12. Returns
Type Description
void