A JavaScript implementation made in TypeScript of the Azuriom Auth API.
npm install azuriom-auth
import{AuthClient}from'azuriom-auth'asyncfunctionlogin(email,password){constclient=newAuthClient('<url of your website>')letresult=awaitclient.login(email,password)if(result.status==='pending'&&result.requires2fa){consttwoFactorCode='<two factor code>'// IMPORTANT: Replace with the 2FA user temporary coderesult=awaitclient.login(email,password,twoFactorCode)}if(result.status!=='success'){throw'Unexpected result: '+JSON.stringify(result)}returnresult}