Quick start with WordAuth OS
Install the SDK, create an API key, and call the Auth API at os.wordauth.com.
WordAuth OS exposes a REST API at https://os.wordauth.com/api/v1. The official wordauth npm package covers Auth, OTP, users, sessions, and all platform services.
npm install wordauth
import { WordAuth } from "wordauth";
const wordauth = new WordAuth({
apiKey: process.env.WORDAUTH_API_KEY!,
subOrgId: process.env.WORDAUTH_SUB_ORG_ID,
});
// Discover enabled auth methods
const { methods } = await wordauth.auth.methods();
// OTP login flow
const { otp_id } = await wordauth.auth.login.otp.send({
email: "[email protected]",
});
const { session } = await wordauth.auth.login.otp.verify({
email: "[email protected]",
otp_id,
code: "red bird",
});
console.log(session.access_token);