consthatDomain="testing.hubat.net";try {constres=hat.auth().isDomainRegistered(hatDomain); if (res) {// HAT domain is registered } } catch (e) {// HAT domain doesn't exist}
Sign out
Example:
hat.auth().signOut();
Get HAT domain
Example:
constres=hat.auth().getHatDomain(); if (res) {// Returns the HAT Domain// eg. testing.hubat.net}
Get auth token
Example:
constres=hat.auth().getToken(); if (res) {// Returns the auth token}
Check if token has expired
Example:
consttoken='<auth-token>';if (hat.auth().isTokenExpired(token)) {// Token has expired}
Generate HAT login URL
Example:
consthatDomain='testing.hubat.net';constappId='our-app-id';constredirect='callback-url';constfallback='fallback-url';consturl=hat.auth().generateHatLoginUrl(hatDomain, appId, redirect, fallback); if (url) {window.location.href = url;}