auth
Verify magic link
Exchanges the magic link token (from the link sent by send) for a session. Returns token and user on success. Token is short-lived and single-use.
POST
/api/auth/magic-link/verifyAuthentication
Public — No Auth Required
Request Body
The token from the magic link URL.
json
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InVzZXJAZXhhbXBsZS5jb20iLCJwcm9qZWN0SWQiOiI2ODVhZDMwYmUxMjk5MzJmYmI3YTEwNDciLCJpYXQiOjE3NTA3ODA4OTgsImV4cCI6MTc1MDc4NDQ5OH0.example"
}{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InVzZXJAZXhhbXBsZS5jb20iLCJwcm9qZWN0SWQiOiI2ODVhZDMwYmUxMjk5MzJmYmI3YTEwNDciLCJpYXQiOjE3NTA3ODA4OTgsImV4cCI6MTc1MDc4NDQ5OH0.example"
}SDK setup
Create a client instance. No authentication is required for this endpoint.
import { MudbaseClient } from "mudbase";
const client = new MudbaseClient();import { MudbaseClient } from "mudbase";
const client = new MudbaseClient();Example request
Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.
const result = await client.auth.verifyMagicLink({
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfZGVtbyJ9.sig_sample"
});const result = await client.auth.verifyMagicLink({
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfZGVtbyJ9.sig_sample"
});Try It Live
Test this endpoint with your own credentials. Your requests will be sent to the live API.
No Request Yet
Send a request to see the full inspector
Responses
200Magic link verified
json
{
"message": "Magic link verified successfully",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 1800,
"user": {
"_id": "685acbe0e129932fbb7a0fc2",
"email": "user@example.com",
"firstName": "John",
"lastName": "Doe",
"role": "user"
}
}{
"message": "Magic link verified successfully",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 1800,
"user": {
"_id": "685acbe0e129932fbb7a0fc2",
"email": "user@example.com",
"firstName": "John",
"lastName": "Doe",
"role": "user"
}
}400Bad request or validation error.
401Authentication required or invalid token.
403Access denied or insufficient permissions.
Errors
| Code | Meaning |
|---|---|
400 | Bad request or validation error. |
401 | Authentication required or invalid token. |
403 | Access denied or insufficient permissions. |