IntroductionBefore you beginTerminologyGetting started
Authorization
IntroductionOAuth 2.0AutonomousRequest a nonceRequest a client tokenRequest a delegation tokenPin
Accounts
Entities
User accounts
GroupsFilesFoldersTemplatesEmail templatesAppsErrors

Autonomous authentication

Using autonomous authentication, neither your RSA private key used by your client id nor the password of the User ID are sent over the wire.
All requests are done over HTTPS using TLS 1.3.


Overview of the Autonomous authentication flow.

Autonomous authentication flow


Request a nonce

A nonce is a string generated by the server that you will need in order to form a self-signed token. You'll need a client id for this.

More info on how to register a new client here.

Request nonce
POST/auto/auth/nonce/1


Body parameters


client_idstringThe client ID as registered in SmartVault.
{
"client_id": "SampleCRMWeb"
}

Request


Headers:
Content-Type:application/json
Accept:application/json
Body:
{
"client_id": "SampleCRMWeb"
}

Response


Returns the nonce after the code property.

Show success object


Will return an error object if the client id is not specified in the request body.

Show error object








Request a client token


This call is used to request a client token. This is the token you will use to authenticate each time your application makes a call to the API.

Request client token
POST/auto/auth/ctoken/1

The client token is used for administrative tasks like adding users and delegating on behalf of users.
In order to request a client token, you will need to form a self-signed token using the nonce and Client ID:

// Structure to generate a self-signed token
BASE64
(
"SLF00" + Length(UTF8(Client ID)) + UTF8(Client ID) + Length(Nonce) + Nonce
SIGN(SHA256("SLF00" + Length(UTF8(ClientId)) + UTF8(ClientId) + Length(Nonce) + Nonce)
)

Where the reserved names used correspond to:

BASE64Base 64 encoding of string.
UTF8UTF 8 encoding of string.
LENGTHLength of string. Maximum value is 255.
SIGNPKI Signing operation using your private key.
SHA256SHA-256 Hash Algorithm applied to data.


Code snippets


Find below some snippets that may help you build the code needed for retrieving the client token.

Use of external dependencies may be being used in these code snippets. e.g. "BouncyCastle" is an OpenSource library for the C# example.

Show code snippets



Body parameters


tokenstringThe self-signed access token that you formed using the Client ID and the nonce.
{
"token": "U0xGMDAMU2FtcGxlQ1JNV2ViFmNmRFh1bkhDYTBXZW5tUVhuU3BJOUHEXtJ+Je5g/igf0DtUcPmPw/5MPyxzZxzrKksa8UObxuiOOtFg38hL3cEMs67ggPwPZGwVF4WMb2Ix+7xGtfp0WPBRzkwUQMJZKGmBJ5PRFkGmX5M4vjmLriwFjYXa0xsGPArgQa2/dPW2gKt0xx1nAQbntDjH7kkbxoKxO+Rklw=="
}

Request


Headers:
Content-Type:application/json
Accept:application/json
Body:
{
"token": "U0xGMDAMU2FtcGxlQ1JNV2ViFmNmRFh1bkhDYTBXZW5tUVhuU3BJOUHEXtJ+Je5g/igf0DtUcPmPw/5MPyxzZxzrKksa8UObxuiOOtFg38hL3cEMs67ggPwPZGwVF4WMb2Ix+7xGtfp0WPBRzkwUQMJZKGmBJ5PRFkGmX5M4vjmLriwFjYXa0xsGPArgQa2/dPW2gKt0xx1nAQbntDjH7kkbxoKxO+Rklw=="
}

Response


Returns the client token and its expiracy.

Show success object


Will return an error object if the token built is not specified in the request body or not valid.








Request a delegation token

The delegation token is used to perform actions on a user's behalf.

The user must have authorized your application in order for you to be able to do this. If not authorized, this call will return an access denied error.
To perform this authorization process, check here.

If you are using autonomous authentication, you will need to use the "Authorization" header to authenticate this request using the client id and the client token that you should have retrieved earlier.
The basic access authorization header value for this request needs to be:

clientId + ':' + clientToken

For the "user_email" body parameter, you need to specify your SmartVault account email, not the one you used to request the delegation token (the developer account email).

Request delegation token
POST/auto/auth/dtoken/1


Body parameters


user_emailstringThe SmartVault account email address (not the developer one!).
{
"user_email": "test@smartvault.com"
}

Request


Headers:
Content-Type:application/json
Accept:application/json
Authorization: Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==
Body:
{
"user_email": "test@smartvault.com"
}

Response


Returns the delegation token, its expiracy and the id related to the user used for retrieving it.

Show success object


Will return an error object if using the autonomous authentication and the Authorization header is not specified (access denied) or an error object if the "user_email" of the body is missing.

Show error object