Authentication

CrediLinq APIs use the Auth0 protocol for authentication and authorization. CrediLinq supports standard Auth0 mechanism for web server, client-side, installed, and limited-input device applications.

Obtaining Client Credentials

To begin with, the CrediLinq support team usually provides Auth0 client credentials upon request to our customers for Sandbox, Staging and Production environments. Then your client requests an access token from the CrediLinq Authorization Server, extracts a token from the response, and sends the token to the CrediLinq API.

📘

Client Credentials

The client credentials consists of a client_id and a client_secret.

Auth0 Steps

All applications follow a basic pattern when accessing a CredLinq API using Auth0. At a high level, this is a two-step, straightforward process to follow.

Generating Token

Generating Token

1. Obtain Auth0 Credentials

Each customer retrieves their own Auth0 credentials through the CrediLinq API support team. Credentials consist of a client ID and client secret known to both CrediLinq and your application. The set of values varies based on what type of application you are building.

❗️

Securing User Credentials

Partners must ensure to secure the client ID and secret to avoid any inconvenience.

2. Obtain Access Token

Before your application can access private data using a CrediLinq API, it must obtain an access token that grants access to that API. A single access token can grant varying degrees of access to multiple APIs.

📘

Authorization URL

CrediLinq API access token is obtained by passing Client Credentials to our authorizationUrl which is available at:

https://stage-api.credilinq.ai/v1/auth/generate-token

Sample Token Generation

Here is a sample cURL to generate a token.

curl --request POST \
     --url https://stage-api.credilinq.ai/v1/auth/generate-token \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "client_id": "2Hancbwhybyfy2nusfbuwbuwb",
  "client_secret": "y6tydyy-swfnv34-fnjjnve_eknk"
}
'

Upon successful authentication, CrediLinq authentication responds back to JSON object containing token.

{
  "statusCode": 200,
  "data": {
    "access_token": "eyJraWQiOiJ3YitJMjNzOWRCNUh0cjBhQXVwTHVjeFwvUFhWREhlVEcyQWpTNnkyNFBjYz0iLCJhbGciOiJSUzI1NiJ9",
    "scope": "<scope>",
    "expires_in": 600000,
    "token_type": "Bearer"
  },
  "message": "Success",
  "success": true
}

❗️

Token Expiry

Each generated token is valid for 60 minutes only.

3. Consume an API

CrediLinq API calls require authorization that uses the Authorization header to provide authentication credentials to the server. The authentication mechanism uses the Bearer token for every API Call. To make an API call with a Bearer token, the client sends an HTTP request with an Authorization header that includes the word Bearer followed by a space and the access token value.

curl --request POST \
     --url https://stage-api.credilinq.ai/v1/loan/calculateloanschedule \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'Authorization: Bearer eyJraWQiOiJ3YitJMjNzOWRCNUh0cjBhQXVwTHVjeFwvUFhWREhlVEcyQWpTNnkyNFBjYz0iLCJhbGciOiJSUzI1NiJ9' \
     --data '
{
  "customerReferenceNo": "Test Reference Number",
  "loanAmount": 2000,
  "loanTermFrequency": 30
}
'