Skip to main content
Skip table of contents

Authentication

This document provides instructions on how to authenticate with our API using OAuth 2.0.

Setup

To successfully authenticate, you will need the following parameters:

Parameter

Description

Value

accessTokenUrl

The URL to request the access token.

https://keycloak.{{account-example}}.{{enviornment}}.docbyte.cloud/realms/{{tenant}}/protocol/openid-connect/token

account-example ,environment & tenant will be provided by Docbyte

clientId

Client identifier for OAuth.

Provided by Docbyte

clientSecret

Client secret for OAuth.

Provided by Docbyte

scope

Scope defining access permissions.

openid email profile


Token Retrieval Process

Request

POST <accessTokenUrl>

Content Type

CODE
application/x-www-form-urlencoded

Required Parameters

To authenticate, include the following parameters in the request body, formatted as URL-encoded:

Parameter

Value

grant_type

client_credentials.

client_id

The client ID provided by Docbyte.

client_secret

The client secret provided by Docbyte.

scope

openid email profile.


Response

Upon a successful request, the authentication service will respond with a JSON object containing the following information:

JSON
{
    "access_token": "{access token}",
    "expires_in": 300,
    "refresh_expires_in": 0,
    "token_type": "Bearer"
}

Token Validity

Each generated token is valid for 5 minutes.


Use the Token in Requests

In each API request, ensure the Authorization Header is set to Bearer Token and includes the retrieved access token.

CODE
Authorization: Bearer <your_access_token>

Error

If an attempt is made to access the API without authentication, the service will return a 401 Unauthorized status.

JSON
{
	"message": null,
	"code": "NOT_AUTHORIZED"
}

Summary

To authenticate:

  1. Obtain necessary credentials and endpoint from Docbyte.

  2. Send a POST request to the accessTokenUrl with the required parameters.

  3. Use the returned access_token in your API requests for secure access.

  4. Re-authenticate every 5 minutes or as needed to maintain valid session access.

By following this setup, you ensure that your API interactions remain secure and within our authorization policies. For further support, please contact the Docbyte team.


Example in Postman

Screenshot 2024-11-06 at 15.08.46.png
Screenshot 2024-11-06 at 15.11.40.png


OAuth 2.0 Authentication Flow

image-20241023-153236.png

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.