email endpoints
These two API allow you to authenticate a user using a magic link.
Method | Ressources | Description |
---|---|---|
POST | /email/requests | Send an authentication request |
POST | /email/tokens | Exchange an authorization code to an access_token |
POST /email/requests
This endpoint send an authentication request to the provided user’s email
.
The user is sent back to the callback_uri
url with an authorization code
.
Request Body
Response
Response Codes
Code | Description |
---|---|
200 | You did great. |
400 | Malformed request. Could be a malformed email or callback url. Important: callback url must use https . |
429 | Too many auth requests. The user must retry after retry_at . Could append if too many requests are made against a specific email address or from an abusing IP. |
Usage
simple authentication
Optional: With Proof Key for Code Exchange (PKCE)
For additional security and prevent the authorization code to be intercepted (URL scheme spoofing on app, malicious browser extension, web server logs, etc.) you can generate a random string and send the associated hash result (code_challenge
) to the authenticate endpoint.
POST /email/tokens
Once the user has clicked on the link sent by email, they will be redirected to the url defined by callback_uri
with the parameter code
.
This can be exchanged for an access token
with this following API endpoint.
The authorization code
is valid only one time and up to 20 minutes: Your users have to click on the authorization button before this delay to grant the access.
Request Body
Response
The access token
is valid for 10 minutes.
Response Codes
Code | Description |
---|---|
200 | You are awesome! |
400 | Malformed request. |
401 | The authorization code is invalid (malformed or expired) or has already been used. |