Skip to Content

Authentication

Embed SDK host integration is based on host-owned identity:

  1. Host app authenticates user
  2. Host backend signs TaskOn login payload
  3. Host frontend calls embed.login(...)

Login Types

Auth Typetype valueaccount
Email"Email"User email
EVM Wallet"WalletAddress"Wallet address

Use isAuthorized() before login():

const isAuthorized = await embed.isAuthorized("Email", "[email protected]"); if (!isAuthorized) { const signed = await fetch("/api/taskon/sign", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ type: "Email", account: "[email protected]", }), }).then((res) => res.json()); await embed.login({ type: "Email", account: "[email protected]", signature: signed.signature, timestamp: signed.timestamp, }); } else { await embed.login({ type: "Email", account: "[email protected]", }); }

Wallet Login

Wallet login requires an EIP-1193 provider:

const accounts = await window.ethereum.request({ method: "eth_requestAccounts", }); const address = accounts[0]; const isAuthorized = await embed.isAuthorized("WalletAddress", address); if (!isAuthorized) { const signed = await getWalletSignatureFromServer(address); await embed.login({ type: "WalletAddress", account: address, signature: signed.signature, timestamp: signed.timestamp, provider: window.ethereum, }); } else { await embed.login({ type: "WalletAddress", account: address, provider: window.ethereum, }); }

Logout

// Recommended: keep auth cache for fast re-login await embed.logout();
// Security-sensitive: clear authorization cache await embed.logout({ clearAuth: true });

Handle loginRequired Event

embed.on("loginRequired", () => { openLoginModal(); });

Security Notes

  • Never expose TaskOn private key in browser code
  • Always generate signatures on server side
  • Keep signature timestamp as milliseconds (13 digits)

See Node Utilities for server signing.

Last updated on