Auth
Use Auth module to handle authentication.
import { Auth } from "@akord/akord-js";By default
Authis using SRP authenticationAuthstores tokens inStorageimplementationStoragedefaults to localStorage on web & memoryStorage on nodeJsStorageimplementation can be configured withAuth.configure({ storage: window.sessionStorage })Authis automatically refreshing tokens in SRP modeOn server side it is recommended to use API keys:
Auth.configure({ apiKey: 'your_api_key' })API key: can be generated over web app & over CLI
Short-lived token with refresh
import { Auth } from "@akord/akord-js";
Auth.configure({ storage: window.sessionStorage }); // optionally - configure tokens storeAPI key
import { Auth } from "@akord/akord-js";
Auth.configure({ apiKey: "api_key" });Self-managed auth token
import { Akord, Auth } from "@akord/akord-js";
Auth.configure({ authToken: "auth_token" });signIn(email, password)
email(string, required)password(string, required)returns
Promise<{ wallet, jwt }>- Promise with JWT token & Akord Wallet
signUp(email, password)
email(string, required)password(string, required)clientMetadata(any, optional) - JSON client metadata, ex: { clientType: "CLI" }returns
Promise<AkordWallet>- Promise with Akord Wallet
verifyAccount(email, code)
email(string, required)code(string, required)returns
Promise<void>
Last updated
Was this helpful?