curl --request POST \
--url https://api-dev.narrative.io/authentication/registration-status \
--header 'Content-Type: application/json' \
--data '
{
"stytch_token": {
"token_type": "magiclinks",
"token": "cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun"
},
"session_duration_minutes": 60
}
'import requests
url = "https://api-dev.narrative.io/authentication/registration-status"
payload = {
"stytch_token": {
"token_type": "magiclinks",
"token": "cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun"
},
"session_duration_minutes": 60
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
stytch_token: {
token_type: 'magiclinks',
token: 'cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun'
},
session_duration_minutes: 60
})
};
fetch('https://api-dev.narrative.io/authentication/registration-status', 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://api-dev.narrative.io/authentication/registration-status",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'stytch_token' => [
'token_type' => 'magiclinks',
'token' => 'cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun'
],
'session_duration_minutes' => 60
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-dev.narrative.io/authentication/registration-status"
payload := strings.NewReader("{\n \"stytch_token\": {\n \"token_type\": \"magiclinks\",\n \"token\": \"cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun\"\n },\n \"session_duration_minutes\": 60\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-dev.narrative.io/authentication/registration-status")
.header("Content-Type", "application/json")
.body("{\n \"stytch_token\": {\n \"token_type\": \"magiclinks\",\n \"token\": \"cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun\"\n },\n \"session_duration_minutes\": 60\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/authentication/registration-status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"stytch_token\": {\n \"token_type\": \"magiclinks\",\n \"token\": \"cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun\"\n },\n \"session_duration_minutes\": 60\n}"
response = http.request(request)
puts response.read_body{
"status": "complete",
"email": "[email protected]",
"stytch_session_token": "example-stytch-session-token",
"stytch_session_jwt": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImV4YW1wbGUta2V5In0.eyJpc3MiOiJodHRwczovL2V4YW1wbGUuY29tIiwiYXVkIjpbImV4YW1wbGUtcHJvamVjdCJdLCJzdWIiOiJleGFtcGxlLXVzZXIiLCJpYXQiOjAsIm5iZiI6MCwiZXhwIjowfQ.ZXhhbXBsZS1zaWduYXR1cmUtbm90LXZhbGlk"
}Check whether a Stytch Magic Links or OAuth user is registered on Narrative
Authenticates the Magic Links or OAuth token with Stytch, and reports whether an active Narrative user is linked to the Stytch user. The response carries the Stytch session token that the login and register APIs take.
curl --request POST \
--url https://api-dev.narrative.io/authentication/registration-status \
--header 'Content-Type: application/json' \
--data '
{
"stytch_token": {
"token_type": "magiclinks",
"token": "cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun"
},
"session_duration_minutes": 60
}
'import requests
url = "https://api-dev.narrative.io/authentication/registration-status"
payload = {
"stytch_token": {
"token_type": "magiclinks",
"token": "cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun"
},
"session_duration_minutes": 60
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
stytch_token: {
token_type: 'magiclinks',
token: 'cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun'
},
session_duration_minutes: 60
})
};
fetch('https://api-dev.narrative.io/authentication/registration-status', 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://api-dev.narrative.io/authentication/registration-status",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'stytch_token' => [
'token_type' => 'magiclinks',
'token' => 'cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun'
],
'session_duration_minutes' => 60
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-dev.narrative.io/authentication/registration-status"
payload := strings.NewReader("{\n \"stytch_token\": {\n \"token_type\": \"magiclinks\",\n \"token\": \"cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun\"\n },\n \"session_duration_minutes\": 60\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-dev.narrative.io/authentication/registration-status")
.header("Content-Type", "application/json")
.body("{\n \"stytch_token\": {\n \"token_type\": \"magiclinks\",\n \"token\": \"cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun\"\n },\n \"session_duration_minutes\": 60\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/authentication/registration-status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"stytch_token\": {\n \"token_type\": \"magiclinks\",\n \"token\": \"cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun\"\n },\n \"session_duration_minutes\": 60\n}"
response = http.request(request)
puts response.read_body{
"status": "complete",
"email": "[email protected]",
"stytch_session_token": "example-stytch-session-token",
"stytch_session_jwt": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImV4YW1wbGUta2V5In0.eyJpc3MiOiJodHRwczovL2V4YW1wbGUuY29tIiwiYXVkIjpbImV4YW1wbGUtcHJvamVjdCJdLCJzdWIiOiJleGFtcGxlLXVzZXIiLCJpYXQiOjAsIm5iZiI6MCwiZXhwIjowfQ.ZXhhbXBsZS1zaWduYXR1cmUtbm90LXZhbGlk"
}Body
The token Stytch put in the redirect URL after a Magic Links or OAuth sign-in. token_type says which product
issued it.
- Option 1
- Option 2
Show child attributes
Show child attributes
The lifetime in minutes of the Stytch session to start. Stytch starts a session only when this is set, and the login and register endpoints need that session.
Response
OK
The example tokens are synthetic and cannot be used to authenticate.
complete when an active Narrative user is linked to the Stytch user or member, so the next call is login.
pending when there is none yet, so the next call is register.
complete, pending The verified email address Stytch has for the user or member.
The Stytch session token to pass to login or register.
The same Stytch session, as a JWT.
Was this page helpful?

