1. Authentication
Parameters | Type |
hatDomain | string |
Example:
const hatDomain = "testing.hubat.net";
try {
const res = hat.auth().isDomainRegistered(hatDomain);
if (res) {
// HAT domain is registered
}
} catch (e) {
// HAT domain doesn't exist
}
Example:
hat.auth().signOut();
Example:
const res = hat.auth().getHatDomain();
if (res) {
// Returns the HAT Domain
// eg. testing.hubat.net
}
Example:
const res = hat.auth().getToken();
if (res) {
// Returns the auth token
}
Example:
const token = '<auth-token>';
if (hat.auth().isTokenExpired(token)) {
// Token has expired
}
Example:
const hatDomain = 'testing.hubat.net';
const appId = 'our-app-id';
const redirect = 'callback-url';
const fallback = 'fallback-url';
const url = hat.auth().generateHatLoginUrl(hatDomain, appId, redirect, fallback);
if (url) {
window.location.href = url;
}
Last modified 1yr ago