INNER CODE UNIT · TypeScript
initAuth
dfinity/examples · motoko/vetkeys/basic_bls_signing/frontend/src/main.ts:57
async function initAuth() {
const isLocalEnv =
window.location.hostname === "localhost" ||
window.location.hostname.endsWith(".localhost");
// The client mints its delegations by calling the II canister, so its agent
// needs the network's root key to verify the responses.
authClient = new AuthClient({
identityProvider: {
authorizeUrl: isLocalEnv
? "http://id.ai.localhost:8000/authorize"
: "https://id.ai/authorize",
canisterId: "rdmx6-jaaaa-aaaaa-aaadq-cai",
},
agentOptions: { rootKey: canisterEnv?.IC_ROOT_KEY },
});
const isAuthenticated = authClient.isAuthenticated();
if (isAuthenticated) {