Login
The 'Login' API enables to authenticate users by verifying their credentials and granting them access to application based on valid credentials
Method: POST
{{URL}}/rpc/admin/UserService/GetToken
Headers
Name | Value |
---|---|
Content-Type | application/json |
Example
Request Parameters
Parameter | Description |
---|---|
emailid Mandatory | String Registered Username/email Id for login Sample value: "admin@NetXD.com" |
password Mandatory | String Password associated with the email Id Sample value: "Abc@1234" |
deviceID Mandatory | String Id of device for which login requested Sample value: "917038" |
- cURL
- C#
- Go
- NodeJs
curl --location '{{URL}}/rpc/admin/UserService/GetToken' \
--header 'Content-Type: application/json' \
--data-raw '{"emailid":"admin@NetXD.com","password":"Test@1234","deviceID":"917038"}'
var options = new RestClientOptions("{{URL}}")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/rpc/admin/UserService/GetToken", Method.Post);
request.AddHeader("Content-Type", "application/json");
var body = @"{" + "\n" +
@" ""emailid"": ""admin@NetXD.com""," + "\n" +
@" ""password"": ""Test@1234""," + "\n" +
@" ""deviceID"": ""917038""" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "{{URL}}/rpc/admin/UserService/GetToken"
method := "POST"
payload := strings.NewReader(`{
"emailid": "admin@NetXD.com",
"password": "Test@1234",
"deviceID": "917038"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': '{{URL}}',
'path': '/rpc/admin/UserService/GetToken',
'headers': {
'Content-Type': 'application/json'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({
"emailid": "admin@NetXD.com",
"password": "Test@1234",
"deviceID": "917038"
});
req.write(postData);
req.end();
Body
{
"emailid": "admin@NetXD.com",
"password": "Test@1234",
"deviceID": "917038"
}
Response: 200
Response Parameters
Parameter | Description |
---|---|
authResponse | Object |
userName | String Username associated with the account Sample value: "admin" |
JWT | String JSON Web Token for authentication and authorization purposes Sample value: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTY29wZSI6IkFETUlOIiwiVXNlcklEIjoiMSIsIkxlZ2FsUmVwSUQiOiIiLCJDdXN0b21lcklEIjoiIiwiVXNlckVtYWlsIjoiYWRtaW5AbmV0c3lzLm9yZyIsIlRva2VuSUQiOiIiLCJVc2VyTmFtZSI6ImFkbWluIiwiQ3VzdG9tZXJOYW1lIjoiIiwiSnRpIjoiYmNhNTNiMjAxNmRlNDY1NWJhZThiMzgwNzZkMjQxOGIiLCJLZXkiOiIiLCJSb2xlcyI6W3sibmFtZSI6IlBMIiwicm9sZSI6IlJPTEVfU1VQRVJfQURNSU4ifSx7Im5hbWUiOiJQTCIsInJvbGUiOiJST0xFX0FETUlOIn1dLCJleHAiOjE2ODQ5MjE1NjMsImlzcyI6Imp3dC1hdXRoIiwic3ViIjoiVXNlciIsIlRva2VuRW5hYmxlZCI6ZmFsc2UsIlZlbmRvcklEIjoiIiwiQmFua05hbWUiOiIiLCJCYW5rSUQiOiIifQ.PB5QvKPPiBYalw6KcxkL3eEkl3XlxPBoxG0jQRCvJWc" |
expirationTime | Number Expiration time of the JWT, represented as a timestamp Sample value: 1684921563 |
qrToken | String QR token associated with the account Sample value: "Ledger:None" |
ip | String IP address Sample value: "42.111.165.238" |
type | String Type of user Sample value: "ADMIN" |
lastLoginTime | String Indicates the timestamp of the user's last login Sample value: "2023-05-24T08:12:41.494Z" |
lastLoginIp | String IP address used for the user's last login Sample value: "106.51.2.218" |
otpEnabled | Boolean Specifies whether the user has enabled One-Time Password (OTP) authentication, with "false" indicating that it is disabled Sample value: false |
userRoles | String Roles assigned to the user Sample value: "ROLE_SUPER_ADMIN,ROLE_ADMIN" |
{
"authResponse": {
"userName": "admin",
"JWT": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTY29wZSI6IkFETUlOIiwiVXNlcklEIjoiMSIsIkxlZ2FsUmVwSUQiOiIiLCJDdXN0b21lcklEIjoiIiwiVXNlckVtYWlsIjoiYWRtaW5AbmV0c3lzLm9yZyIsIlRva2VuSUQiOiIiLCJVc2VyTmFtZSI6ImFkbWluIiwiQ3VzdG9tZXJOYW1lIjoiIiwiSnRpIjoiYmNhNTNiMjAxNmRlNDY1NWJhZThiMzgwNzZkMjQxOGIiLCJLZXkiOiIiLCJSb2xlcyI6W3sibmFtZSI6IlBMIiwicm9sZSI6IlJPTEVfU1VQRVJfQURNSU4ifSx7Im5hbWUiOiJQTCIsInJvbGUiOiJST0xFX0FETUlOIn1dLCJleHAiOjE2ODQ5MjE1NjMsImlzcyI6Imp3dC1hdXRoIiwic3ViIjoiVXNlciIsIlRva2VuRW5hYmxlZCI6ZmFsc2UsIlZlbmRvcklEIjoiIiwiQmFua05hbWUiOiIiLCJCYW5rSUQiOiIifQ.PB5QvKPPiBYalw6KcxkL3eEkl3XlxPBoxG0jQRCvJWc",
"expirationTime": 1684921563,
"qrToken": "Ledger:None",
"ip": "42.111.165.238",
"type": "ADMIN",
"lastLoginTime": "2023-05-24T08:12:41.494Z",
"lastLoginIp": "106.51.2.218",
"otpEnabled": false
},
"userRoles": "ROLE_SUPER_ADMIN,ROLE_ADMIN"
}