Login OAuth
Initiate OAuth authorization
Start an OAuth authorization flow for the given provider. Returns the authorization URL to redirect the user to.
POST
/
v1
/
session
/
login
/
oauth
/
{provider}
/
authorize
Initiate OAuth authorization
curl --request POST \
--url https://{appId}.session.prelude.dev/v1/session/login/oauth/{provider}/authorize \
--header 'Content-Type: application/json' \
--data '
{
"redirect_uri": "<string>",
"code_challenge": "<string>",
"dispatch_id": "<string>"
}
'import requests
url = "https://{appId}.session.prelude.dev/v1/session/login/oauth/{provider}/authorize"
payload = {
"redirect_uri": "<string>",
"code_challenge": "<string>",
"dispatch_id": "<string>"
}
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({redirect_uri: '<string>', code_challenge: '<string>', dispatch_id: '<string>'})
};
fetch('https://{appId}.session.prelude.dev/v1/session/login/oauth/{provider}/authorize', 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://{appId}.session.prelude.dev/v1/session/login/oauth/{provider}/authorize",
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([
'redirect_uri' => '<string>',
'code_challenge' => '<string>',
'dispatch_id' => '<string>'
]),
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://{appId}.session.prelude.dev/v1/session/login/oauth/{provider}/authorize"
payload := strings.NewReader("{\n \"redirect_uri\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"dispatch_id\": \"<string>\"\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://{appId}.session.prelude.dev/v1/session/login/oauth/{provider}/authorize")
.header("Content-Type", "application/json")
.body("{\n \"redirect_uri\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"dispatch_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{appId}.session.prelude.dev/v1/session/login/oauth/{provider}/authorize")
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 \"redirect_uri\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"dispatch_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"authorization_url": "<string>"
}{
"code": "bad_request",
"type": "bad_request"
}{
"code": "internal",
"type": "internal"
}Path Parameters
The OAuth provider identifier (e.g., "google", "apple", "facebook", "linkedin")
Example:
"google"
Body
application/json
The URI to redirect to after OAuth authorization.
Example:
"https://example.com/callback"
PKCE code challenge for the OAuth flow.
Example:
"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"
The identifier of the dispatch from the front-end SDK.
Example:
"123e4567-e89b-12d3-a456-426614174000"
Response
OK
The URL to redirect the user to for OAuth authorization.
Example:
"https://accounts.google.com/o/oauth2/v2/auth?client_id=...&redirect_uri=...&scope=openid+email&state=..."
⌘I
Initiate OAuth authorization
curl --request POST \
--url https://{appId}.session.prelude.dev/v1/session/login/oauth/{provider}/authorize \
--header 'Content-Type: application/json' \
--data '
{
"redirect_uri": "<string>",
"code_challenge": "<string>",
"dispatch_id": "<string>"
}
'import requests
url = "https://{appId}.session.prelude.dev/v1/session/login/oauth/{provider}/authorize"
payload = {
"redirect_uri": "<string>",
"code_challenge": "<string>",
"dispatch_id": "<string>"
}
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({redirect_uri: '<string>', code_challenge: '<string>', dispatch_id: '<string>'})
};
fetch('https://{appId}.session.prelude.dev/v1/session/login/oauth/{provider}/authorize', 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://{appId}.session.prelude.dev/v1/session/login/oauth/{provider}/authorize",
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([
'redirect_uri' => '<string>',
'code_challenge' => '<string>',
'dispatch_id' => '<string>'
]),
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://{appId}.session.prelude.dev/v1/session/login/oauth/{provider}/authorize"
payload := strings.NewReader("{\n \"redirect_uri\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"dispatch_id\": \"<string>\"\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://{appId}.session.prelude.dev/v1/session/login/oauth/{provider}/authorize")
.header("Content-Type", "application/json")
.body("{\n \"redirect_uri\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"dispatch_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{appId}.session.prelude.dev/v1/session/login/oauth/{provider}/authorize")
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 \"redirect_uri\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"dispatch_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"authorization_url": "<string>"
}{
"code": "bad_request",
"type": "bad_request"
}{
"code": "internal",
"type": "internal"
}