Connectors
Complete OAuth authorization
Exchange an OAuth authorization code for an encrypted connector.
POST
/
v1
/
oauth
/
{provider}
/
callback
Complete OAuth authorization
curl --request POST \
--url https://api.sprites.dev/v1/oauth/{provider}/callback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "oauth-code",
"access_policy": {
"allow_all": true
},
"redirect_uri": "https://api.sprites.dev/v1/oauth/slack/callback",
"state": "opaque-state"
}
'import requests
url = "https://api.sprites.dev/v1/oauth/{provider}/callback"
payload = {
"code": "oauth-code",
"access_policy": { "allow_all": True },
"redirect_uri": "https://api.sprites.dev/v1/oauth/slack/callback",
"state": "opaque-state"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: 'oauth-code',
access_policy: {allow_all: true},
redirect_uri: 'https://api.sprites.dev/v1/oauth/slack/callback',
state: 'opaque-state'
})
};
fetch('https://api.sprites.dev/v1/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.sprites.dev/v1/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 => json_encode([
'code' => 'oauth-code',
'access_policy' => [
'allow_all' => true
],
'redirect_uri' => 'https://api.sprites.dev/v1/oauth/slack/callback',
'state' => 'opaque-state'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.sprites.dev/v1/oauth/{provider}/callback"
payload := strings.NewReader("{\n \"code\": \"oauth-code\",\n \"access_policy\": {\n \"allow_all\": true\n },\n \"redirect_uri\": \"https://api.sprites.dev/v1/oauth/slack/callback\",\n \"state\": \"opaque-state\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.sprites.dev/v1/oauth/{provider}/callback")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"oauth-code\",\n \"access_policy\": {\n \"allow_all\": true\n },\n \"redirect_uri\": \"https://api.sprites.dev/v1/oauth/slack/callback\",\n \"state\": \"opaque-state\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sprites.dev/v1/oauth/{provider}/callback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"oauth-code\",\n \"access_policy\": {\n \"allow_all\": true\n },\n \"redirect_uri\": \"https://api.sprites.dev/v1/oauth/slack/callback\",\n \"state\": \"opaque-state\"\n}"
response = http.request(request)
puts response.read_body{
"connection": {
"id": "conn_abc123",
"provider": "slack"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json
OAuth callback request
Authorization code returned by the provider.
Example:
"oauth-code"
Initial access policy. Empty or missing policies deny sprite use until updated.
Show child attributes
Show child attributes
Example:
{ "allow_all": true }
Redirect URI used to create the authorization URL.
Example:
"https://api.sprites.dev/v1/oauth/slack/callback"
State value from the authorize response.
Example:
"opaque-state"
Response
Created
Connector response
Sanitized connector. Secrets and encrypted token fields are never returned.
Show child attributes
Show child attributes
Example:
{ "id": "conn_abc123", "provider": "slack" }
⌘I
Complete OAuth authorization
curl --request POST \
--url https://api.sprites.dev/v1/oauth/{provider}/callback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "oauth-code",
"access_policy": {
"allow_all": true
},
"redirect_uri": "https://api.sprites.dev/v1/oauth/slack/callback",
"state": "opaque-state"
}
'import requests
url = "https://api.sprites.dev/v1/oauth/{provider}/callback"
payload = {
"code": "oauth-code",
"access_policy": { "allow_all": True },
"redirect_uri": "https://api.sprites.dev/v1/oauth/slack/callback",
"state": "opaque-state"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: 'oauth-code',
access_policy: {allow_all: true},
redirect_uri: 'https://api.sprites.dev/v1/oauth/slack/callback',
state: 'opaque-state'
})
};
fetch('https://api.sprites.dev/v1/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.sprites.dev/v1/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 => json_encode([
'code' => 'oauth-code',
'access_policy' => [
'allow_all' => true
],
'redirect_uri' => 'https://api.sprites.dev/v1/oauth/slack/callback',
'state' => 'opaque-state'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.sprites.dev/v1/oauth/{provider}/callback"
payload := strings.NewReader("{\n \"code\": \"oauth-code\",\n \"access_policy\": {\n \"allow_all\": true\n },\n \"redirect_uri\": \"https://api.sprites.dev/v1/oauth/slack/callback\",\n \"state\": \"opaque-state\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.sprites.dev/v1/oauth/{provider}/callback")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"oauth-code\",\n \"access_policy\": {\n \"allow_all\": true\n },\n \"redirect_uri\": \"https://api.sprites.dev/v1/oauth/slack/callback\",\n \"state\": \"opaque-state\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sprites.dev/v1/oauth/{provider}/callback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"oauth-code\",\n \"access_policy\": {\n \"allow_all\": true\n },\n \"redirect_uri\": \"https://api.sprites.dev/v1/oauth/slack/callback\",\n \"state\": \"opaque-state\"\n}"
response = http.request(request)
puts response.read_body{
"connection": {
"id": "conn_abc123",
"provider": "slack"
}
}