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(
"http://localhost:8000/", //endpoint
"default", //tenant Id
"default" //access key
);
const retrieveTenantsForEmail = async () => {
try {
api.config.accessToken = '*****************';
const tenants = await api.Authentication.retrieveTenantsForEmail('[email protected]');
console.log(tenants, 'Tenants fetched successfully');
} catch (err) {
console.log('Error fetching Tenants:', err);
}
};
retrieveTenantsForEmail();
import view_sdk
from view_sdk import configuration
sdk = view_sdk.configure( access_key="default",base_url="http://localhost:8000/", tenant_guid= "00000000-0000-0000-0000-000000000000")
def getTenantsForEmail():
tenants = configuration.Authentication.retrieve_tenants_for_email("[email protected]")
print(tenants)
getTenantsForEmail()
using View.Sdk;
using View.Sdk.Configuration;
public static class Example {
public static async Task Main(string[] args)
{
ViewConfigurationSdk sdk = new ViewConfigurationSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"),"default", "http://view.homedns.org:8000/");
Console.Write("Enter your email: ");
string email = Console.ReadLine();
sdk.Email = email;
sdk.Password = null;
sdk.PasswordSha256 = null;
sdk.TenantGUID = null;
sdk.XToken = null;
List<TenantMetadata> tenants = await sdk.Authentication.RetrieveTenants();
foreach (var tenant in tenants)
{
Console.WriteLine($"{tenant}");
}
}
}
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(
"http://localhost:8000/", //endpoint
"default", //tenant Id
"default" //access key
);
const generateAuthenticationToken = async () => {
try {
const response = await api.Authentication.generateAuthenticationTokenByPassword({
email: "[email protected]",
password: "password",
tenantGUID: "<tenant-guid>",
});
console.log(response, "Authentication token generated successfully");
} catch (err) {
console.log("Error generating Authentication token:", err);
}
};
import view_sdk
from view_sdk import configuration
def getAuthenticationToken():
token = configuration.Authentication.generate_authentication_token("[email protected]","password","00000000-0000-0000-0000-0000000000000")
print(token)
getAuthenticationToken()
using View.Sdk;
using View.Sdk.Configuration;
ViewConfigurationSdk sdk = new ViewConfigurationSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"),"default", "http://view.homedns.org:8000/");
sdk.Email = "[email protected]";
sdk.Password = "abc****";
sdk.PasswordSha256 = null;
sdk.TenantGUID = "default";
sdk.XToken = null;
AuthenticationToken respobse = await sdk.Authentication.GenerateTokenWithPassword();
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(
"http://localhost:8000/", //endpoint
"default", //tenant Id
"default" //access key
);
const generateAuthenticationTokenBySHA256 = async () => {
try {
const response = await api.Authentication.generateAuthenticationTokenBySHA256({
email: "[email protected]",
passwordSHA256:
"*********************",
tenantGUID: "<tenant-guid>",
});
console.log(response, "Authentication token generated successfully");
} catch (err) {
console.log("Error generating Authentication token:", err);
}
};
generateAuthenticationTokenBySHA256();
import view_sdk
from view_sdk import configuration
def getAuthenticationTokenSha256():
token = configuration.Authentication.generate_authentication_token_sha_256("[email protected]","e75255193871e245472533552fe45dfda25768d26e9eb92507e75263e90c6a4","00000000-0000-0000-0000-0000000000000")
print(token)
getAuthenticationTokenSha256()
using View.Sdk;
using View.Sdk.Configuration;
ViewConfigurationSdk sdk = new ViewConfigurationSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"),"default", "http://view.homedns.org:8000/");
sdk.Email = "[email protected]";;
sdk.Password = null;
sdk.PasswordSha256 = "ab******************************";
sdk.TenantGUID = "default";
sdk.XToken = null;
AuthenticationToken token = await sdk.Authentication.GenerateTokenWithPasswordSha256();
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(
"http://localhost:8000/", //endpoint
"default", //tenant Id
"default" //access Key
);
const generateAdminToken = async () => {
try {
const response = await api.Authentication.generateAdministratorToken({
email: "[email protected]",
password: "*********",
});
console.log(response, "Admin token generated successfully");
} catch (err) {
console.log("Error generating Admin token:", err);
}
};
generateAdminToken();
import view_sdk
from view_sdk import configuration
def getAdministratorToken():
token = configuration.Authentication.retrieve_administrator_token( email="[email protected]",password="default")
print(token)
# getAdministratorToken()
using View.Sdk;
using View.Sdk.Configuration;
ViewConfigurationSdk sdk = new ViewConfigurationSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"),"default", "http://view.homedns.org:8000/");
sdk.Email = "[email protected]";
sdk.Password = "abc****";
sdk.PasswordSha256 = null;
sdk.TenantGUID = null;
sdk.XToken = null;
AuthenticationToken token = await sdk.Authentication.GenerateAdminTokenWithPassword();
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(
"http://localhost:8000/",//endpoint
"default", //tenant Id
"default" //access Key
);
const generateAdministratorTokenBySHA256 = async () => {
try {
const response = await api.Authentication.generateAdministratorTokenBySHA256({
email: "[email protected]",
passwordSHA256:
"****************",
});
console.log(response, "Administrator token generated successfully");
} catch (err) {
console.log("Error generating Administrator token:", err);
}
};
generateAdministratorTokenBySHA256();
import view_sdk
from view_sdk import configuration
sdk = view_sdk.configure( access_key="default",base_url="http://localhost:8000/", tenant_guid= "00000000-0000-0000-0000-000000000000")
def getAdministratorTokenSha256():
token = configuration.Authentication.retrieve_administrator_token_sha_256( email="[email protected]",password="e75255193871e245472533552fe45dfda25768d26e9eb92507e75263e90c6a4")
print(token)
getAdministratorTokenSha256()
using View.Sdk;
using View.Sdk.Configuration;
ViewConfigurationSdk sdk = new ViewConfigurationSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"),"default", "http://view.homedns.org:8000/");
sdk.Email = "[email protected]";
sdk.Password = null;
sdk.PasswordSha256 = "adb*************************";
sdk.TenantGUID = null;
sdk.XToken = null;
AuthenticationToken token = await sdk.Authentication.GenerateAdminTokenWithPasswordSha256();
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(
"http://localhost:8000/", //endpoint
"default", //tenant Id
"default", //access Key
);
const validateToken = async () => {
try {
const response = await api.Authentication.validateAuthenticationToken({
token:"*****",
});
console.log(response, "Token validated successfully");
} catch (err) {
console.log("Error validating token:", err);
}
};
validateToken();
import view_sdk
from view_sdk import configuration
sdk = view_sdk.configure( access_key="default",base_url="http://localhost:8000/", tenant_guid= "00000000-0000-0000-0000-000000000000")
def validateAuthenticationToken():
token = configuration.Authentication.validate_authentication_token(token="*****")
print(token)
validateAuthenticationToken()
using View.Sdk;
using View.Sdk.Configuration;
public static class Example {
public static async Task Main(string[] args)
{
ViewConfigurationSdk sdk = new ViewConfigurationSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"),"default", "http://view.homedns.org:8000/");
Console.Write("Enter your email: ");
string email = Console.ReadLine();
Console.Write("Enter your password: ");
string password = Console.ReadLine();
sdk.Email = null;
sdk.Password = null;
sdk.PasswordSha256 = null;
sdk.TenantGUID = null;
sdk.XToken = "default";
AuthenticationToken token = await sdk.Authentication.ValidateToken();
Console.WriteLine(token);
}
}
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(
"http://localhost:8000/", //endpoint
"default", //tenant Id
"default" //access Key
);
const getTokenDetails = async () => {
try {
const response = await api.Authentication.retrieveTokenDetails({
token:"*******",
});
console.log(response, "Token details fetched successfully");
} catch (err) {
console.log("Error fetching Token details:", err);
}
};
getTokenDetails();
import view_sdk
from view_sdk import configuration
sdk = view_sdk.configure( access_key="default",base_url="http://localhost:8000/", tenant_guid= "00000000-0000-0000-0000-000000000000")
def retrieveTokenDetails():
token = configuration.Authentication.retrieve_token_details(token="*****")
print(token)
retrieveTokenDetails()
using View.Sdk;
using View.Sdk.Configuration;
ViewConfigurationSdk sdk = new ViewConfigurationSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"),"default", "http://view.homedns.org:8000/");
sdk.Email = null;
sdk.Password = null;
sdk.PasswordSha256 = null;
sdk.TenantGUID = null;
sdk.XToken = "default";
AuthenticationToken token = await sdk.Authentication.RetrieveTokenDetails();
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
}