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
-
RequiredMagic Token in the Magic Link received by the UserMinimum length is
1. -
OptionalExtend 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_tokenandsession_jwt. However, if a validsession_tokenorsession_jwtis sent in, it will extend that session by the minutes specified. If not sent in, no session will be created by default. -
OptionalUnique session token to verify. -
OptionalUnique Session JWT to verify.
curl \
--request POST 'https://api.streambird.io/v1/auth/magic_links/verify' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"token":"CzJ1WTtyCF2wqhavQYiy9m7GayazthwamK4DKC07Ac6B2Fmn"}'
{
"token": "CzJ1WTtyCF2wqhavQYiy9m7GayazthwamK4DKC07Ac6B2Fmn"
}
{
"user_id": "user_24wFP9pDa9YiMJLun94iKykoZs2",
"method_id": "email_24oXBL3PufzHkH1Jzyjc2EXYeo7",
"method_type": "email"
}
{
"error_type": "invalid_magic_token",
"status_code": 400,
"error_message": "Invalid magic link format, magic link missing or invalid."
}