Request access token
Request an OAuth access token (and, depending on the grant type, a refresh token).
Supported grant types:
client_credentials— pass yourclient_idandclient_secretto receive a new access token and refresh token.refresh_token— pass yourclient_idand the existingrefresh_tokento get a new pair of tokens.authorization_code— pass theauthCodeto get an access token for a specific user. Use this when building your own client.
curl --request POST \
--url https://stage-api.findity.com/api/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data client_id=9fe5e8409bd511ed851263dc7e596f1e \
--data client_secret=972ace009bd511edb416cb73503f108bimport requests
url = "https://stage-api.findity.com/api/oauth/token"
payload = {
"grant_type": "client_credentials",
"client_id": "9fe5e8409bd511ed851263dc7e596f1e",
"client_secret": "972ace009bd511edb416cb73503f108b"
}
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({
grant_type: 'client_credentials',
client_id: '9fe5e8409bd511ed851263dc7e596f1e',
client_secret: '972ace009bd511edb416cb73503f108b'
})
};
fetch('https://stage-api.findity.com/api/oauth/token', 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://stage-api.findity.com/api/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=client_credentials&client_id=9fe5e8409bd511ed851263dc7e596f1e&client_secret=972ace009bd511edb416cb73503f108b",
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://stage-api.findity.com/api/oauth/token"
payload := strings.NewReader("grant_type=client_credentials&client_id=9fe5e8409bd511ed851263dc7e596f1e&client_secret=972ace009bd511edb416cb73503f108b")
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://stage-api.findity.com/api/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=client_credentials&client_id=9fe5e8409bd511ed851263dc7e596f1e&client_secret=972ace009bd511edb416cb73503f108b")
.asString();require 'uri'
require 'net/http'
url = URI("https://stage-api.findity.com/api/oauth/token")
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 = "grant_type=client_credentials&client_id=9fe5e8409bd511ed851263dc7e596f1e&client_secret=972ace009bd511edb416cb73503f108b"
response = http.request(request)
puts response.read_body{
"access_token": "MWnNTCwqspGJwmATOqZ9T1GhseXc93i0D6AFbEjFut7Kyz5GhEElXpByzwIE0kk92QKWGCscbLgrXfTr4RkJB64WivXBKkZBk",
"token_type": "Bearer",
"expires_in": 36000,
"refresh_token": "GLjW5pkF9tudhdn1AwpPpbe5dS7i6Uoe5HoL0IluEatyQ+y02zbTMsx8FCqwUH0Q8PLhF65Xj643taiIQ9gG7dNgS0ehSqfYBh"
}Body
The OAuth 2.0 grant type. Use client_credentials to authenticate with a client ID and secret, refresh_token to exchange a refresh token for a new token pair, or authorization_code to exchange an authorization code for tokens.
client_credentials, refresh_token, authorization_code The client application identifier.
The client application secret.
Use together with grant_type refresh_token.
Use together with grant_type authorization_code.
Response
OK
The issued Bearer access token. Include this in the Authorization: Bearer <token> header for subsequent API requests.
The type of the issued token. Always Bearer.
Lifetime of the access token in seconds.
A refresh token that can be used to obtain a new access token using the refresh_token grant type. Each refresh token can only be used once.
curl --request POST \
--url https://stage-api.findity.com/api/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data client_id=9fe5e8409bd511ed851263dc7e596f1e \
--data client_secret=972ace009bd511edb416cb73503f108bimport requests
url = "https://stage-api.findity.com/api/oauth/token"
payload = {
"grant_type": "client_credentials",
"client_id": "9fe5e8409bd511ed851263dc7e596f1e",
"client_secret": "972ace009bd511edb416cb73503f108b"
}
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({
grant_type: 'client_credentials',
client_id: '9fe5e8409bd511ed851263dc7e596f1e',
client_secret: '972ace009bd511edb416cb73503f108b'
})
};
fetch('https://stage-api.findity.com/api/oauth/token', 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://stage-api.findity.com/api/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=client_credentials&client_id=9fe5e8409bd511ed851263dc7e596f1e&client_secret=972ace009bd511edb416cb73503f108b",
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://stage-api.findity.com/api/oauth/token"
payload := strings.NewReader("grant_type=client_credentials&client_id=9fe5e8409bd511ed851263dc7e596f1e&client_secret=972ace009bd511edb416cb73503f108b")
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://stage-api.findity.com/api/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=client_credentials&client_id=9fe5e8409bd511ed851263dc7e596f1e&client_secret=972ace009bd511edb416cb73503f108b")
.asString();require 'uri'
require 'net/http'
url = URI("https://stage-api.findity.com/api/oauth/token")
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 = "grant_type=client_credentials&client_id=9fe5e8409bd511ed851263dc7e596f1e&client_secret=972ace009bd511edb416cb73503f108b"
response = http.request(request)
puts response.read_body{
"access_token": "MWnNTCwqspGJwmATOqZ9T1GhseXc93i0D6AFbEjFut7Kyz5GhEElXpByzwIE0kk92QKWGCscbLgrXfTr4RkJB64WivXBKkZBk",
"token_type": "Bearer",
"expires_in": 36000,
"refresh_token": "GLjW5pkF9tudhdn1AwpPpbe5dS7i6Uoe5HoL0IluEatyQ+y02zbTMsx8FCqwUH0Q8PLhF65Xj643taiIQ9gG7dNgS0ehSqfYBh"
}
