Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

PersonalAuthAPI- Scoped

The PersonalAuthAPI provides methods that enable you to manage access/refresh tokens for personal authentication credentials.

To access this API the Personal Authentication (com.snc.sn_ihub_personal_auth) plugin must be activated. This API runs in the sn_cc namespace.

Before accessing this API, Personal Authentication must be configured on your instance. For additional information, see Create a Connection & Credential alias.

Parent Topic:Server API reference

PersonalAuthAPI - PersonalAuthAPI()

Instantiates a new PersonalAuthAPI object.

NameTypeDescription
None 

The following code example shows how to instantiate a PersonalAuthAPI object.

var personalAuthAPI = new sn_cc.PersonalAuthAPI();

PersonalAuthAPI - getInitiatorURL(String aliasId)

Returns the OAuth initiator URL for the personal authentication credential associated with a specified alias.

NameTypeDescription
aliasIdStringSys\_id of the connection or credential alias whose OAuth initiator URL you want to retrieve.Table: Connection & Credential Aliases \[sys\_alias\]
TypeDescription
StringOAuth initiator URL for the personal authentication credential associated with the specified alias. If the personal authentication credential doesn't exist for the specified alias, the method returns an empty string.

The following code example shows how to call this method.

var aliasId = "e41b9dd1532102104c4bddeeff7b1250";
var personalAuthAPI = new sn_cc.PersonalAuthAPI();
var result = personalAuthAPI.getInitiatorURL(aliasId);
gs.info(result);

Output:

/oauth_initiator.do?oauth_requestor_context=oauth_2_0_credentials&oauth_requestor=d84b5115532102104c4bddeeff7b12f2&oauth_provider_profile=d84b5115532102104c4bddeeff7b12ec&response_type=code&personal=true 

PersonalAuthAPI - isTokenValid(String aliasId)

Checks whether a valid access/refresh token exists for the personal authorization credential associated with a specified alias.

NameTypeDescription
aliasIdStringSys\_id of the connection or credential alias to check for the associated personal authorization credential.Table: Connection & Credential Aliases \[sys\_alias\]
TypeDescription
BooleanFlag that indicates whether there's an associated personal authorization credential for the specified alias ID.Possible values: - true: A valid personal authorization credential exists. - false: A valid personal authorization credential doesn't exist.

The following code example shows how to call this method.

var aliasId = "e41b9dd1532102104c4bddeeff7b1250"; 
var personalAuthAPI = new sn_cc.PersonalAuthAPI();  
var result = personalAuthAPI.isTokenValid(aliasId); 
gs.info(result);

Output:

true

PersonalAuthAPI - revokeToken(String aliasId)

Revokes an existing access/refresh token for the personal authentication credential associated with a specified alias.

NameTypeDescription
aliasIdStringSys\_id of the connection or credential alias whose access/refresh token for the personal authorization credential you want to revoke.Table: Connection & Credential Aliases \[sys\_alias\]
TypeDescription
ObjectObject that contains methods that you can call to obtain additional information about the status of the credential and method call. These methods are available until the next time this method is called.- <object\_name>.getResponseStatus\(\): Returns the status of the revokeToken\(\) method call, either `success` or `fail`. You can find additional information on any error in the error logs. - <object\_name>.getExpiryInSeconds\(\): Returns the number of seconds until the associated credential expires. If this value is anything other than zero, the revoke request failed. - <object\_name>.isAuthenticated\(\): Returns a Boolean value that indicates whether the personal auth token exists. If the revokeToken\(\) method call was successful, this method should return `false`. - <object\_name>.getCredentialId\(\): Returns the sys\_id of the personal authorization credential associated with the token. Located in the OAuth 2.0 Credentials \[oauth\_2\_0\_credentials\] table.

The following code example shows how to call this method.

var aliasId = "e41b9dd1532102104c4bddeeff7b1250";
var personalAuthAPI = new sn_cc.PersonalAuthAPI();
var personalAuthResponse = personalAuthAPI.revokeToken(aliasId); 
gs.info(personalAuthResponse.getResponseStatus());
gs.info(personalAuthResponse.getExpiryInSeconds());
gs.info(personalAuthResponse.isAuthenticated());
gs.info(personalAuthResponse.getCredentialId());

Output:

SUCCESS
0
false
d84b5115532102104c4bddeeff7b12f2