Authenticate with magic link
curl --request PATCH \
--url https://{defaultHost}/v1/auth/{app_id}/magic_links/authenticate \
--header 'Authorization: Bearer <token>' \
--header 'X-Authorization: <api-key>'import requests
url = "https://{defaultHost}/v1/auth/{app_id}/magic_links/authenticate"
headers = {
"Authorization": "Bearer <token>",
"X-Authorization": "<api-key>"
}
response = requests.patch(url, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'X-Authorization': '<api-key>'}
};
fetch('https://{defaultHost}/v1/auth/{app_id}/magic_links/authenticate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/v1/auth/{app_id}/magic_links/authenticate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"X-Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/v1/auth/{app_id}/magic_links/authenticate"
req, _ := http.NewRequest("PATCH", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("X-Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://{defaultHost}/v1/auth/{app_id}/magic_links/authenticate")
.header("Authorization", "Bearer <token>")
.header("X-Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/auth/{app_id}/magic_links/authenticate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["X-Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"access": "<string>",
"refresh": "<string>",
"csrf": "<string>",
"access_expires_at": "2023-11-07T05:31:56Z",
"refresh_expires_at": "2023-11-07T05:31:56Z",
"user_id": "<string>",
"key_id": "<string>"
}{
"verification_required": true,
"reason": "security_verification",
"threats": [
"<string>"
]
}{
"error": "Login blocked for security reasons",
"error_code": "security_block"
}{
"error": "Magic link not found or expired",
"error_code": "magic_link_not_found_or_expired"
}Magic Links
Authenticate with magic link
Authenticate a magic link token and return session tokens. This endpoint validates the magic link token and creates a new session for the user.
PATCH
/
v1
/
auth
/
{app_id}
/
magic_links
/
authenticate
Authenticate with magic link
curl --request PATCH \
--url https://{defaultHost}/v1/auth/{app_id}/magic_links/authenticate \
--header 'Authorization: Bearer <token>' \
--header 'X-Authorization: <api-key>'import requests
url = "https://{defaultHost}/v1/auth/{app_id}/magic_links/authenticate"
headers = {
"Authorization": "Bearer <token>",
"X-Authorization": "<api-key>"
}
response = requests.patch(url, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'X-Authorization': '<api-key>'}
};
fetch('https://{defaultHost}/v1/auth/{app_id}/magic_links/authenticate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/v1/auth/{app_id}/magic_links/authenticate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"X-Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/v1/auth/{app_id}/magic_links/authenticate"
req, _ := http.NewRequest("PATCH", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("X-Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://{defaultHost}/v1/auth/{app_id}/magic_links/authenticate")
.header("Authorization", "Bearer <token>")
.header("X-Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/auth/{app_id}/magic_links/authenticate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["X-Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"access": "<string>",
"refresh": "<string>",
"csrf": "<string>",
"access_expires_at": "2023-11-07T05:31:56Z",
"refresh_expires_at": "2023-11-07T05:31:56Z",
"user_id": "<string>",
"key_id": "<string>"
}{
"verification_required": true,
"reason": "security_verification",
"threats": [
"<string>"
]
}{
"error": "Login blocked for security reasons",
"error_code": "security_block"
}{
"error": "Magic link not found or expired",
"error_code": "magic_link_not_found_or_expired"
}Authorizations
API Secret token
User Access token
Path Parameters
App ID
Response
successful authentication
JWT access token
JWT refresh token
CSRF token for protected operations
Access token expiration timestamp
Refresh token expiration timestamp
App user ID
App key ID for JWT verification
Was this page helpful?
⌘I