Skip to main content
magicLinks.authenticate wraps the authenticate Email Magic Link endpoint. Use this method to authenticate a with an Email Magic Link. This method verifies that the magic link token is valid, hasn’t expired, and hasn’t been previously used. The method will return a Session object if authentication succeeds.

Parameters

The Email Magic Link token to authenticate. You can get this from the URL query parameter token after the user clicks the magic link.
number
required
Set the session lifetime to be this many minutes from now. This will return both an opaque session_token and session_jwt for this session, which will automatically be stored in the browser cookies. The session_jwt will have a fixed lifetime of five minutes regardless of the underlying session duration, and will be automatically refreshed by the SDK in the background over time.This value must be a minimum of 5 and may not exceed the maximum session duration minutes value set in the Frontend SDK page of the Stytch Dashboard.A successful authentication will continue to extend the session this many minutes.
string
Used to determine which language to use when sending the user this delivery method. Parameter is an IETF BCP 47 language tag, e.g. “en”.Supported languages are English (“en”), Spanish (“es”), French (“fr”) and Brazilian Portuguese (“pt-br”); if no value is provided, the copy defaults to English.

Response

string
The unique ID of the Member.
object
The new Stytch Session.
object
The Member object of the signed-in Member.
object
The Organization object of the Organization the Member has signed into.
string
The JWT for the new Stytch Session.
If the project is configured to use HttpOnly cookies, this field will always be an empty string.
string
The secret token for the new Stytch Session.
If the project is configured to use HttpOnly cookies, this field will always be an empty string.
object
If Protected Auth is enabled and returned fingerprinting results, this field will contain information about the member’s device attributes.
boolean
Indicates whether the Member is fully authenticated. If false, the Member needs to complete an MFA step to log in to the Organization.
string
The intermediate_session_token that should be passed into a secondary authentication endpoint, such as OTP authenticate, in order to receive a member session. The intermediate_session_token can also be used with discovery endpoints to join a different organization or create a new organization.If the member is fully authenticated, this field will be an empty string.
If the project is configured to use HttpOnly cookies, this field will always be an empty string.
object | null
The types of primary authentication required.
object | null
The types of secondary authentication required to join the Organization.
object
If Protected Auth is enabled and returned fingerprinting results, this field will contain information about the member’s device attributes.
string
The ID of the email used to send the magic link.
string
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
number
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.