This page covers configuration and management of user authentication, token generation and validation.
Retrieve tenants for email
To get tenants linked to particular email, call GET /v1.0/token/tenants
curl --location 'http://view.homedns.org:8000/v1.0/token/tenants' \
--header 'x-email: [email protected]' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";
const api = new ViewConfigurationSdk(
"default", //tenant Id
"default", //access token
"http://localhost:8000/" //endpoint
);
const retrieveTenantsForEmail = async () => {
try {
const response = await api.retrieveTenantsForEmail("[email protected]");
console.log(response, "Tenants fetched successfully");
} catch (err) {
console.log("Error fetching Tenants:", err);
}
};
retrieveTenantsForEmail();
Response:
[
{
GUID: '00000000-0000-0000-0000-000000000000',
parentGUID: null,
name: 'Default Tenant',
region: 'us-west-1',
s3BaseDomain: '',
restBaseDomain: 'localhost',
defaultPoolGUID: '00000000-0000-0000-0000-000000000000',
active: true,
createdUtc: '2025-03-25T21:12:32.461527Z',
accountGUID: '00000000-0000-0000-0000-000000000000',
isProtected: true
}
]
Generate authentication token (using password)
To generate authentication token (using password), call GET /v1.0/token/tenants
curl --location 'http://view.homedns.org:8000/v1.0/token' \
--header 'x-email: [email protected]' \
--header 'x-password: password' \
--header 'x-tenant-guid: 00000000-0000-0000-0000-000000000000' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";
const api = new ViewConfigurationSdk(
"default", //tenant Id
"default", //access token
"http://localhost:8000/" //endpoint
);
const generateAuthenticationToken = async () => {
try {
const response = await api.generateAuthenticationTokenByPassword({
email: "[email protected]",
password: "password",
tenantGUID: "00000000-0000-0000-0000-000000000000",
});
console.log(response, "Authentication token generated successfully");
} catch (err) {
console.log("Error generating Authentication token:", err);
}
};
Response:
{
"TimestampUtc": "2025-04-02T06:44:16.540236Z",
"ExpirationUtc": "2025-04-03T06:44:16.540202Z",
"IsExpired": false,
"Token": "*****",
"Valid": true
}
Generate authentication token (using password SHA-256)
To Generate authentication token (using password SHA-256), call GET /v1.0/token/tenants
curl --location 'http://view.homedns.org:8000/v1.0/token' \
--header 'x-email: [email protected]' \
--header 'x-password-sha256: 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8' \
--header 'x-tenant-guid: 00000000-0000-0000-0000-000000000000' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";
const api = new ViewConfigurationSdk(
"default", //tenant Id
"default", //access token
"http://localhost:8000/" //endpoint
);
const generateAuthenticationTokenBySHA256 = async () => {
try {
const response = await api.generateAuthenticationTokenBySHA256({
email: "[email protected]",
passwordSHA256:
"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",
tenantGUID: "00000000-0000-0000-0000-000000000000",
});
console.log(response, "Authentication token generated successfully");
} catch (err) {
console.log("Error generating Authentication token:", err);
}
};
generateAuthenticationTokenBySHA256();
Response:
{
"TimestampUtc": "2025-04-02T06:52:02.837124Z",
"ExpirationUtc": "2025-04-03T06:52:02.837094Z",
"IsExpired": false,
"Token": "*****",
"Valid": true
}
Generate administrator token (using password)
To generate administrator token (using password), call GET /v1.0/token/tenants
curl --location 'http://view.homedns.org:8000/v1.0/token' \
--header 'x-email: [email protected]' \
--header 'x-password: viewadmin' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";
const api = new ViewConfigurationSdk(
"default", //tenant Id
"default", //access token
"http://localhost:8000/" //endpoint
);
const generateAdminToken = async () => {
try {
const response = await api.generateAdministratorToken({
email: "[email protected]",
password: "password",
});
console.log(response, "Admin token generated successfully");
} catch (err) {
console.log("Error generating Admin token:", err);
}
};
generateAdminToken();
Response:
{
"TimestampUtc": "2025-04-02T06:52:02.837124Z",
"ExpirationUtc": "2025-04-03T06:52:02.837094Z",
"IsExpired": false,
"Token": "*****",
"Valid": true
}
Generate administrator token (using password SHA-256)
To generate administrator token (using password SHA-256), call GET /v1.0/token/tenants
curl --location 'http://view.homedns.org:8000/v1.0/token' \
--header 'x-email: [email protected]' \
--header 'x-password-sha256: e75255193871e245472533552fe45dfda25768d26e9eb92507e75263e90c6a48' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";
const api = new ViewConfigurationSdk(
"default", //tenant Id
"default", //access token
"http://localhost:8000/" //endpoint
);
const generateAdministratorTokenBySHA256 = async () => {
try {
const response = await api.generateAdministratorTokenBySHA256({
email: "[email protected]",
passwordSHA256:
"e75255193871e245472533552fe45dfda25768d26e9eb92507e75263e90c6a48",
});
console.log(response, "Administrator token generated successfully");
} catch (err) {
console.log("Error generating Administrator token:", err);
}
};
generateAdministratorTokenBySHA256();
Response:
{
"TimestampUtc": "2025-04-02T07:03:54.516294Z",
"ExpirationUtc": "2025-04-03T07:03:54.516265Z",
"IsExpired": false,
"Token": "*****",
"Valid": true
}
Validate authentication token
To validate authentication token, call GET /v1.0/token/tenants
curl --location 'http://view.homedns.org:8000/v1.0/token/validate' \
--header 'x-token: *****' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";
const api = new ViewConfigurationSdk(
"default", //tenant Id
"default", //access token
"http://localhost:8000/" //endpoint
);
const validateToken = async () => {
try {
const response = await api.validateAuthenticationToken({
token:"*****",
});
console.log(response, "Token validated successfully");
} catch (err) {
console.log("Error validating token:", err);
}
};
validateToken();
Response:
{
"TimestampUtc": "2025-04-02T07:08:54.577789Z",
"ExpirationUtc": "2025-04-03T07:06:25.427405Z",
"IsExpired": false,
"Valid": true
}
Retrieve token details
To validate authentication token, call GET /v1.0/token/tenants
curl --location 'http://view.homedns.org:8000/v1.0/token/details' \
--header 'x-token: ******' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";
const api = new ViewConfigurationSdk(
"default", //tenant Id
"default", //access token
"http://localhost:8000/" //endpoint
);
const getTokenDetails = async () => {
try {
const response = await api.retrieveTokenDetails({
token:"*******",
});
console.log(response, "Token details fetched successfully");
} catch (err) {
console.log("Error fetching Token details:", err);
}
};
getTokenDetails();
Response:
{
"TimestampUtc": "2025-04-02T07:06:25.427406Z",
"ExpirationUtc": "2025-04-03T07:06:25.427405Z",
"IsExpired": false,
"AccountGUID": "00000000-0000-0000-0000-000000000000",
"TenantGUID": "00000000-0000-0000-0000-000000000000",
"UserGUID": "00000000-0000-0000-0000-000000000000",
"User": {
"GUID": "00000000-0000-0000-0000-000000000000",
"TenantGUID": "00000000-0000-0000-0000-000000000000",
"FirstName": "Default",
"LastName": "User",
"FullName": "Default User",
"Notes": "Default password is password",
"Email": "[email protected]",
"PasswordSha256": "************************************************************42d8",
"Active": true,
"IsProtected": true,
"CreatedUtc": "2025-03-25T21:12:32.461527Z"
},
"Valid": true
}