Verify Token
Verify the magic token of a magic link to authenticate the user. This endpoints verifies that the magic token sent in is valid and returns the method ID and verified user ID.
HTTP Request
POST /v1/auth/magic_links/verify
Returns
A successful response returns an object with method_id
, method_type
, and verified user_id
properties. If session parameters are sent in, session_token
, session_jwt
and session
will be included in the response.
Body
-
Required
Magic Token in the Magic Link received by the UserMinimum length is
1
. -
session_expires_in integer
Optional
Extend the session expiration time to N minutes from now, must be between 5 to 525600 minutes (365 days). This parameter will create a new session if there is no existing session along with asession_token
andsession_jwt
. However, if a validsession_token
orsession_jwt
is sent in, it will extend that session by the minutes specified. If not sent in, no session will be created by default. -
session_token string
Optional
Unique session token to verify. -
session_jwt string
Optional
Unique Session JWT to verify.
curl \
-X POST https://api.streambird.io/v1/auth/magic_links/verify \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"token":"CzJ1WTtyCF2wqhavQYiy9m7GayazthwamK4DKC07Ac6B2Fmn"}'
{
"token": "CzJ1WTtyCF2wqhavQYiy9m7GayazthwamK4DKC07Ac6B2Fmn"
}
{
"method_id": "email_24oXBL3PufzHkH1Jzyjc2EXYeo7",
"method_type": "email",
"user_id": "user_24wFP9pDa9YiMJLun94iKykoZs2"
}
{
"status_code": 400,
"error_message": "Invalid magic link format, magic link missing or invalid.",
"error_type": "invalid_magic_token"
}