Usage
Send a one time 6-digit code to the user via email link / email code / SMS code.
This is the first step of the authentication process. The developer is responsible for the second step, which is to call authenticateWithSecret
with the code sent by this method.
This means the developer is responsible for the UI that prompts the user to enter the code.
import { Marble, AuthMethod } from "marble-sdk";
const marble = new Marble("<YOUR_CLIENT_KEY>");
await marble.auth.sendAuthenticationCode({
authenticationMethod: AuthMethod.EmailCode,
email: "theodor@marblewallet.com"
});
Return value
The function will return null
if the code was sent successfully. If the code was not sent successfully, the function will throw an error.
Configuration
authenticationMethod (required)
The authentication method to use. Can be one of the following:
AuthMethod.EmailLink
AuthMethod.EmailCode
AuthMethod.SMSCode
- (Coming Soon)
AuthMethod.2FA
email (optional)
The user's email address. This is the email address that will receive the authentication code. One of email
or phoneNumber
is required.
phoneNumber (optional)
The user's phone number (E.164 format). This is the phone number that will receive the authentication code. One of email
or phoneNumber
is required.