Sign-up and Sign-in
User registration and sign-in are performed through the signin method.
javascript
import { signin } from "@noauth/browser";
const { verified, accessToken } = await signin("[email protected]", {
apiKey: "your-api-key",
});
if (verified) {
console.log("User authenticated with token:", accessToken);
}javascript
import { NoAuth } from "@noauth/browser";
const noauth = new NoAuth({ apiKey: "your-api-key" });
const { verified, accessToken } = await noauth.signin("[email protected]");
if (verified) {
console.log("User authenticated with token:", accessToken);
}signin returns an object with the following properties:
verified: boolean indicating if the user has successfully passed the authentication challenge.emailVerified: boolean indicating if the user's email has been verified correctly. Defaults tofalseand changes its value after the user has completed any OTP flow.accessToken: a JWT (JSON Web Token) that can be used to authenticate your users' requests on your server. Read more about Access Token.
Authentication flow
Under the hood, signin implements a complex authentication flow based on WebAuthn and certified by FIDO2. This flow can be expressed in a sequence diagram like the following: