Overview

The User Authentication API allows users to authenticate themselves and obtain an access token for performing actions in the Vidizmo Portal using REST API. This token is subject to expiration when the user logs out or after the token expires, in that case you will have to refresh the access token. For this article we have trialed the Vidizmo User Authentication api on Postman.


Before You Start

  • Ensure that your Vidizmo portal provides API access and that you have the necessary API credentials to make this API request.  
  • Prepare a reliable testing platform, such as Postman, to test the APIs effectively.
  • Understand the Bearer Token authentication flow, which is used in Vidizmo. Here's a high-level overview: 
    1. Your application makes a request to the Vidizmo Authentication API, typically with your Email ID and Password. 
    2. Vidizmo validates your credentials and issues an access token (Bearer Token) if the credentials are correct. 
    3. This access token is then used to make subsequent API requests by including it in the Authorization header of your HTTP requests. 



User Authentication

To authenticate a user and obtain an access token, follow these steps:


1. Make a POST request  


 {{Your-Domain}}/api/v1/user/authenticate


Make a POST request to the following endpoint:

Note: Here "{{Your-Domain}}" is the tenant URL. Furthermore, this is version v1 of the User Authentication API. 


2. Request Endpoint Details

  • Request Headers: 

Content-Type: application/Json

  • Request Body: 

“EmailAddress (string, required)”: The email address of the user. 

“Password (string, required)”: The user's password.

  • Request Body (Example-Success) 
{
"emailAddress": "{{userEmailAddres}}",
"password": "{{userPassword}}"
}


3. Successful Response 

If the authentication is successful, the response status code will be 200, and you will receive the access token in the response body. 

  • Response Headers:  
    Content-Type: application/json
  • Response Body (Example - Success) 
{    "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}


4. Unsuccessful Response  

If the authentication fails, the response status code will be 400, and an error message will be provided in the response body. 

  • Response Body (Example - Error) 
{
"error": "Invalid credentials",
"message": "Authentication failed"
}


Token Expiration

To refresh the token, you can make a POST request to the following endpoint: /api/v1/user/refresh-access-token 

Alternatively, you can use the following code snippet in the Postman Test section or in the testing environment of your choice:

const "responseText" = "pm.response.text()";
"pm.environment.set" ("Token", "responseText");


The User Authentication API in Vidizmo Portal serves as a pivotal gateway, enabling users to authenticate themselves and acquire access tokens for seamlessly interact with the REST API. For a deeper understanding of the User Authentication Api, you can refer to the comprehensive User Authentication Documentation.


Read Next

Using REST API - Uploading Content