RELAYTO API - Authentication

RELAYTO uses the OAuth 2.0 Authorization Code flow to authenticate users for third-party applications.

Register your application with RELAYTO

RELAYTO invites select developers to integrate their applications with the RELAYTO/ Document Experience Platform. Please email support@relayto.com with the following details:

  • Name of the application
  • Authentication Redirect Callback URL (YOUR_REDIRECT_URL).
    URL must start with https://, e.g. https://yourcompanydomain.com/callback.
    During the OAuth2 authentication flow, your application will receive an AUTHORIZATION_CODE as a query string parameter.

RELAYTO will issue a YOUR_CLIENT_ID and YOUR_CLIENT_SECRET for your application. You will use these credentials to obtain a user access token.

1. Implement RELAYTO "Sign up/Sign in"

In your application, provide a "Sign up/Sign in" option so users can authenticate with RELAYTO. To enable a seamless authentication flow, hyperlink your "Sign up/Sign in" button to the following URL:

https://relayto.com/signin?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URL&response_type=code

IMPORTANT
YOUR_REDIRECT_URL must match exactly the URL submitted during registration.

2. Obtain an Authorization Code

After the user successfully signs in to RELAYTO, the browser will redirect to your callback URL (YOUR_REDIRECT_URL) with an appended AUTHORIZATION_CODE. You will use this code to request a USER_ACCESS_TOKEN in the next step.

Example Redirect URL after sign in:

YOUR_REDIRECT_URL?code=AUTHORIZATION_CODE

Example:

https://yourcompanydomain.com/?code=def50200a6292c72FRer...

3. Get a User Access Token

Once you have the AUTHORIZATION_CODE, request a USER_ACCESS_TOKEN. This access token is required for all authenticated API calls to RELAYTO. You will also receive a USER_REFRESH_TOKEN to renew your access token without re-authentication.

Request example:

curl -X POST 
https://relayto.com/api/oauth2/token 
-H 'content-type: application/x-www-form-urlencoded' 
-d grant_type=authorization_code 
-d client_id=YOUR_CLIENT_ID 
-d client_secret=YOUR_CLIENT_SECRET 
-d code=AUTHORIZATION_CODE 
-d redirect_uri=YOUR_REDIRECT_URL 

Response:

{
   "token_type": "Bearer",
   "expires_in": 86400,
   "access_token": USER_ACCESS_TOKEN,
   "refresh_token": USER_REFRESH_TOKEN
}

Refreshing a User Access Token

To maintain session continuity without re-authentication, use the USER_REFRESH_TOKEN to refresh the USER_ACCESS_TOKEN in the background.

Refresh token request example:

curl -X POST 
https://relayto.com/api/oauth2/token 
-H 'content-type: application/x-www-form-urlencoded' 
-d grant_type=refresh_token 
-d client_id=YOUR_CLIENT_ID 
-d client_secret=YOUR_CLIENT_SECRET 
-d refresh_token=USER_REFRESH_TOKEN

Response:

{
   "token_type": "Bearer",
   "expires_in": 86400,
   "access_token": USER_ACCESS_TOKEN,
   "refresh_token": USER_REFRESH_TOKEN
}