Magic Auth is a passwordless authentication method that allows users to sign in or sign up via a unique, six digit one-time-use code sent to their email inbox. To verify the code, authenticate the user with Magic Auth.
Get the details of an existing Magic Auth code that can be used to send an email to a user for authentication.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const magicAuth = await workos.userManagement.getMagicAuth( 'magic_auth_01E4ZCR3C56J083X43JQXF3JK5', );
GET/user_management /magic_auth /:idParameters Returns Creates a one-time authentication code that can be sent to the user’s email address. The code expires in 10 minutes. To verify the code, authenticate the user with Magic Auth.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const magicAuth = await workos.userManagement.createMagicAuth({ email: 'marcelina@example.com', });
POST/user_management /magic_authReturns