Provider-specific OAuth callback (POST)
curl --request POST \
--url https://api.example.com/api/auth/oauth/{provider}/callback \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'state=<string>' \
--data 'code=<string>' \
--data 'id_token=<string>'import requests
url = "https://api.example.com/api/auth/oauth/{provider}/callback"
payload = {
"state": "<string>",
"code": "<string>",
"id_token": "<string>"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({state: '<string>', code: '<string>', id_token: '<string>'})
};
fetch('https://api.example.com/api/auth/oauth/{provider}/callback', 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.example.com/api/auth/oauth/{provider}/callback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "state=%3Cstring%3E&code=%3Cstring%3E&id_token=%3Cstring%3E",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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.example.com/api/auth/oauth/{provider}/callback"
payload := strings.NewReader("state=%3Cstring%3E&code=%3Cstring%3E&id_token=%3Cstring%3E")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
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.example.com/api/auth/oauth/{provider}/callback")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("state=%3Cstring%3E&code=%3Cstring%3E&id_token=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/auth/oauth/{provider}/callback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "state=%3Cstring%3E&code=%3Cstring%3E&id_token=%3Cstring%3E"
response = http.request(request)
puts response.read_bodyClient
Provider-specific OAuth callback (POST)
OAuth callback endpoint for providers that use POST (e.g., Apple with form_post response mode).
Response varies based on the original OAuth initiation:
- With code_challenge (PKCE): Redirects with
insforge_codefor exchange endpoint - Without code_challenge (web): Redirects with
access_tokenand sets httpOnly cookie
POST
/
api
/
auth
/
oauth
/
{provider}
/
callback
Provider-specific OAuth callback (POST)
curl --request POST \
--url https://api.example.com/api/auth/oauth/{provider}/callback \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'state=<string>' \
--data 'code=<string>' \
--data 'id_token=<string>'import requests
url = "https://api.example.com/api/auth/oauth/{provider}/callback"
payload = {
"state": "<string>",
"code": "<string>",
"id_token": "<string>"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({state: '<string>', code: '<string>', id_token: '<string>'})
};
fetch('https://api.example.com/api/auth/oauth/{provider}/callback', 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.example.com/api/auth/oauth/{provider}/callback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "state=%3Cstring%3E&code=%3Cstring%3E&id_token=%3Cstring%3E",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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.example.com/api/auth/oauth/{provider}/callback"
payload := strings.NewReader("state=%3Cstring%3E&code=%3Cstring%3E&id_token=%3Cstring%3E")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
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.example.com/api/auth/oauth/{provider}/callback")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("state=%3Cstring%3E&code=%3Cstring%3E&id_token=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/auth/oauth/{provider}/callback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "state=%3Cstring%3E&code=%3Cstring%3E&id_token=%3Cstring%3E"
response = http.request(request)
puts response.read_bodyPath Parameters
Available options:
google, github, discord, linkedin, facebook, instagram, tiktok, apple, x, spotify, microsoft Body
application/x-www-form-urlencoded
Response
302
Redirect to application.
- PKCE flow: redirect_uri?insforge_code={code}&user_id={id}&email={email}&name={name}
- Web flow: redirect_uri?access_token={token}&user_id={id}&email={email}&name={name}&csrf_token={csrf}
Was this page helpful?