Login
This endpoint allows users to log in to the Digital Identity system using their phone number and password. If the user is logging in from a new device, they may be required to enter an OTP sent via SMS.
Workflow for Login Endpoint
User Initiates Login: The user sends a POST request to the
/Loginendpoint with theirgeoLocation,imei,phoneNumber, andpassword.Server Validation:
The server validates the provided
phoneNumberandpassword.If logging in from a new device, the server may require an OTP sent to the user's phone number.
Response:
If the credentials are correct and any required OTP is verified, the server responds with an access token and user details.
If the credentials or OTP are incorrect, or any required fields are missing, an appropriate error response is returned.
User login to the Digital Identity system
Success
POST /api/DigitalIdentity/Login HTTP/1.1
Host:
Content-Type: application/json-patch+json
Accept: */*
Content-Length: 209
{
"phoneNumber": "text",
"password": "text",
"geoLocation": {
"latitude": 1,
"longitude": 1
},
"imei": "text",
"imsi": "text",
"phoneNumberOtpRequestId": "text",
"phoneNumberOtp": "text",
"isPhone2FAEnabled": true,
"smsProvider": 1
}Success
{
"data": {
"hasPendingRequest": true,
"isEmailConfirmationRequired": true,
"isEmailConfirmed": true,
"isPhoneNumberConfirmationRequired": true,
"isPhoneNumberConfirmed": true,
"phoneNumberOtp": "text",
"phoneNumberOtpRequestId": "123e4567-e89b-12d3-a456-426614174000",
"emailOtpRequestId": "123e4567-e89b-12d3-a456-426614174000",
"isDigitalIdentityVerified": true,
"accessToken": "text",
"refreshToken": "text",
"encryptedAccessToken": "text",
"phoneOtpExpireInSeconds": 1,
"emailOtpExpireInSeconds": 1,
"user": {
"id": 1,
"name": "text",
"surname": "text",
"fullName": "text",
"userName": "text",
"emailAddress": "text",
"phoneNumber": "text",
"idNumber": "text",
"address": "text"
},
"redirectUri": "text",
"transactionId": "123e4567-e89b-12d3-a456-426614174000"
},
"error_code": 1,
"error_message": "text",
"error_descriptions": null
}To refresh the access token upon its expiration, you can use the below endpoint.
Success
POST /api/DigitalIdentity/RefreshToken HTTP/1.1
Host:
Content-Type: application/json-patch+json
Accept: */*
Content-Length: 23
{
"refreshToken": "text"
}Success
{
"data": {
"refreshToken": "text",
"newRefreshToken": "text",
"accessToken": "text",
"encryptedAccessToken": "text",
"expireInSeconds": 1
},
"error_code": 1,
"error_message": "text",
"error_descriptions": null
}Admin login to the Digital Identity system
Success
POST /api/credentials/Login HTTP/1.1
Host:
Content-Type: application/json-patch+json
Accept: */*
Content-Length: 72
{
"tenancyName": "text",
"userNameOrEmailAddress": "text",
"password": "text"
}Success
{
"data": {
"accessToken": "text",
"encryptedAccessToken": "text",
"expireInSeconds": 1,
"shouldResetPassword": true,
"passwordResetCode": "text",
"userId": 1,
"requiresTwoFactorVerification": true,
"twoFactorAuthProviders": [
"text"
],
"twoFactorRememberClientToken": "text",
"returnUrl": "text",
"refreshToken": "text",
"refreshTokenExpireInSeconds": 1
},
"error_code": 1,
"error_message": "text",
"error_descriptions": null
}To refresh the access token upon its expiration, you can use the below endpoint.
Success
POST /api/credentials/RefreshToken HTTP/1.1
Host:
Content-Type: application/json-patch+json
Accept: */*
Content-Length: 23
{
"refreshToken": "text"
}Success
{
"data": {
"refreshToken": "text",
"newRefreshToken": "text",
"accessToken": "text",
"encryptedAccessToken": "text",
"expireInSeconds": 1
},
"error_code": 1,
"error_message": "text",
"error_descriptions": null
}import axios from 'axios';
const BASE_URL = "https://api.vlenseg.com/api/DigitalIdentity/Login";
const API_KEY = "your_api_key_here";
let lat = "device lat"
let long = "device long"
const data = {
geoLocation: {
latitude: lat,
longitude: long
},
imei: "123456789012345",
phoneNumber: "user phone",
password: "password"
};
try {
const response = await axios.post(BASE_URL, data, {
headers: {
'Content-Type': 'application/json',
'ApiKey': API_KEY
}
});
console.log(response.data);
} catch (error) {
console.error(error.response ? error.response.data : error.message);
}
import requests
BASE_URL = "https://api.vlenseg.com/api/DigitalIdentity/Login"
API_KEY = "your_api_key_here"
HEADERS = {
"Content-Type": "application/json",
"ApiKey": API_KEY
}
data = {
"geoLocation": {
"latitude": "device lat",
"longitude": "device long"
},
"imei": "123456789012345",
"phoneNumber": "+201221211911",
"password": "Password#123"
}
response = requests.post(BASE_URL, headers=HEADERS, json=data)
print(response.json())
curl -X POST "https://api.vlenseg.com/api/DigitalIdentity/Login" \
-H "Content-Type: application/json" \
-H "ApiKey: your_api_key_here" \
-d '{
"geoLocation": {
"latitude": lat,
"longitude": long
},
"imei": "123456789012345",
"phoneNumber": "user number",
"password": "password"
}'
Last updated