users
Sync the signed-in user and return their organizations
The first call a new session makes. Supabase owns the account; this creates the mirror row on first sight and answers with the organizations the user belongs to, so the app can decide between onboarding and a dashboard in one round trip instead of three.
POST
/
v1
/
auth
/
callback-sync
Sync the signed-in user and return their organizations
curl --request POST \
--url https://api.surnex.io/v1/auth/callback-syncimport requests
url = "https://api.surnex.io/v1/auth/callback-sync"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.surnex.io/v1/auth/callback-sync', 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.surnex.io/v1/auth/callback-sync",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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://api.surnex.io/v1/auth/callback-sync"
req, _ := http.NewRequest("POST", url, nil)
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.surnex.io/v1/auth/callback-sync")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.surnex.io/v1/auth/callback-sync")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"user": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "jsmith@example.com",
"full_name": "<string>",
"avatar_url": "<string>",
"theme": "<string>",
"created_at": "2023-11-07T05:31:56Z"
},
"organizations": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"slug": "<string>",
"website": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"phone": "<string>",
"timezone": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"role": "owner"
}
]
}
}⌘I
Sync the signed-in user and return their organizations
curl --request POST \
--url https://api.surnex.io/v1/auth/callback-syncimport requests
url = "https://api.surnex.io/v1/auth/callback-sync"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.surnex.io/v1/auth/callback-sync', 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.surnex.io/v1/auth/callback-sync",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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://api.surnex.io/v1/auth/callback-sync"
req, _ := http.NewRequest("POST", url, nil)
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.surnex.io/v1/auth/callback-sync")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.surnex.io/v1/auth/callback-sync")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"user": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "jsmith@example.com",
"full_name": "<string>",
"avatar_url": "<string>",
"theme": "<string>",
"created_at": "2023-11-07T05:31:56Z"
},
"organizations": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"slug": "<string>",
"website": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"phone": "<string>",
"timezone": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"role": "owner"
}
]
}
}