RequestAuthAPI - Scoped
-
- UpdatedJan 30, 2025
- 3 minutes to read
- Yokohama
- API reference
The RequestAuthAPI provides methods to apply a signature to a REST request.
- HttpRequestData: Build the API request.
- AuthCredential: Create a credential object or update an existing one. Use the credential to sign the request through the RequestAuthAPI class.
- RequestAuthAPI: Sign the request and return an HttpRequestAuthedData object.
- HttpRequestAuthedData: Get information about the signed request.
- GlideHTTPRequest: Send the signed request.
Before using these APIs, you must configure an authentication algorithm to sign the request and associate it with the credential used to authenticate the request.
Use this API in scoped scripts with the sn_auth
namespace identifier.
RequestAuthAPI - RequestAuthAPI(Object data, Object credential)
Instantiates a RequestAuthAPI object using a REST request and a credential.
Name | Type | Description |
---|---|---|
data | Object | HttpRequestData object that contains the unsigned REST request. Use the HttpRequestData class to build this object. See HttpRequestData API. |
credential | Object | Object that represents a record from the Credentials [discovery_credentials] table. Retrieve this object using the AuthCredential class. See AuthCredential API. |
Example
RequestAuthAPI - generateAuth()
Signs the HttpRequestData object and returns an HttpRequestAuthedData object to use to send in the REST request.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
HttpRequestAuthedData | Object. Data to use to obtain information about the signed result. Use the methods in the HttpRequestAuthedData class to interact with the signed result. See HttpRequestAuthedData API. |
Example
This example creates a request and gets a credential record to pass to the RequestAuthAPI API. The generateAuth() method then signs the request.
RequestAuthAPI - getAuthCredential()
Returns the credential record used to sign the request.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
AuthCredential | Object. Data to use to obtain information about the credential record used to sign the request. Use the methods in the AuthCredential class to interact with the credential. See AuthCredential API. |
Example
RequestAuthAPI - getHttpRequestData()
Returns the HttpRequestData object that was used to instantiate the RequestAuthAPI class.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
HttpRequestData | Object. Contains the unsigned REST request. Use the methods in the HttpRequestData class to interact with the request. See HttpRequestData API. |
Example
Output:
RequestAuthAPI - resetAuthCredential()
Generates a temporary, limited privilege token that you can use to provide trusted users with temporary security credentials to control third-party resources.
To use this method, the third-party service must include an API or SDK that processes and manages limited access tokens.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
void |