Generate a new auth token and session for the user
curl --request POST \
--url https://api.payrollintegrationsapp.com/v1/auth/token \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"grantType": "client_credentials"
}
'import requests
url = "https://api.payrollintegrationsapp.com/v1/auth/token"
payload = { "grantType": "client_credentials" }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({grantType: 'client_credentials'})
};
fetch('https://api.payrollintegrationsapp.com/v1/auth/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://api.payrollintegrationsapp.com/v1/auth/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 => json_encode([
'grantType' => 'client_credentials'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.payrollintegrationsapp.com/v1/auth/token"
payload := strings.NewReader("{\n \"grantType\": \"client_credentials\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.payrollintegrationsapp.com/v1/auth/token")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"grantType\": \"client_credentials\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.payrollintegrationsapp.com/v1/auth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"grantType\": \"client_credentials\"\n}"
response = http.request(request)
puts response.read_body{
"accessToken": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ik1UY3pOVEkyTnpnNU1ERT0ifQ.eyJzdWIiOiI5ZjJhNGJjZC03ZThmLTQ1YWItYjkxMi1hYzNkZWY2NzhhOTAiLCJpc3MiOiJodHRwczpcL1wvY29nbml0by1pZHAudXMtd2VzdC0yLmFtYXpvbmF3cy5jb21cL3VzLXdlc3QtMl9TYW1wbGVQb29sIiwiY2xpZW50X2lkIjoiN2g4ajlrMGwxbTJuM280cDVxNnI3czh0OXUiLCJvcmlnaW5fanRpIjoiYjZjN2Q4ZTktZjBhMS00MmIzLThjZDQtZTVmNmE3YjhjOWQwIiwiZXZlbnRfaWQiOiJhNWI2YzdkOC1lOWYwLTQxYTItN2JjMy1kNGU1ZjZhN2I4YzkiLCJ0b2tlbl91c2UiOiJhY2Nlc3MiLCJzY29wZSI6ImF3cy5jb2duaXRvLnNpZ25pbi51c2VyLmFkbWluIiwiYXV0aF90aW1lIjoxNzAwMDAwMDAwLCJleHAiOjE3MDAwMDM2MDAsImlhdCI6MTcwMDAwMDAwMCwianRpIjoiYzFkMmUzZjQtZzVoNi00N2k4LTg5ajAtZGVmZ2gxMjM0aTU2IiwidXNlcm5hbWUiOiJzYW1wbGUtdXNlci03ZjhhOWJjZC0xZTJmLTNnNGgtNWk2ai03azhsOW0wbjFvMnAifQ.VGhpc0lzQVJhbmRvbVNpZ25hdHVyZVRoYXRJc05vdFZhbGlkQW5kU2hvdWxkTm90QmVVc2VkSW5Qcm9kdWN0aW9uRW52aXJvbm1lbnRzV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Bvc2VzT25seVBsZWFzZUdlbmVyYXRlWW91ck93blJlYWxUb2tlbkZyb21Db2duaXRvSW5Qcm9kdWN0aW9uRW52aXJvbm1lbnRzTm90VGhpc0V4YW1wbGU",
"expires_in": 900,
"token_type": "Bearer"
}{
"message": "<string>",
"errors": [
"<string>"
]
}{
"message": "<string>",
"errors": [
"<string>"
]
}{
"message": "<string>",
"errors": [
"<string>"
]
}{
"message": "<string>",
"errors": [
"<string>"
]
}Authentication
Get Authentication Token
Exchanges client credentials (client ID and client secret) for an access token using HTTP Basic Authentication.
POST
/
v1
/
auth
/
token
Generate a new auth token and session for the user
curl --request POST \
--url https://api.payrollintegrationsapp.com/v1/auth/token \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"grantType": "client_credentials"
}
'import requests
url = "https://api.payrollintegrationsapp.com/v1/auth/token"
payload = { "grantType": "client_credentials" }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({grantType: 'client_credentials'})
};
fetch('https://api.payrollintegrationsapp.com/v1/auth/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://api.payrollintegrationsapp.com/v1/auth/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 => json_encode([
'grantType' => 'client_credentials'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.payrollintegrationsapp.com/v1/auth/token"
payload := strings.NewReader("{\n \"grantType\": \"client_credentials\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.payrollintegrationsapp.com/v1/auth/token")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"grantType\": \"client_credentials\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.payrollintegrationsapp.com/v1/auth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"grantType\": \"client_credentials\"\n}"
response = http.request(request)
puts response.read_body{
"accessToken": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ik1UY3pOVEkyTnpnNU1ERT0ifQ.eyJzdWIiOiI5ZjJhNGJjZC03ZThmLTQ1YWItYjkxMi1hYzNkZWY2NzhhOTAiLCJpc3MiOiJodHRwczpcL1wvY29nbml0by1pZHAudXMtd2VzdC0yLmFtYXpvbmF3cy5jb21cL3VzLXdlc3QtMl9TYW1wbGVQb29sIiwiY2xpZW50X2lkIjoiN2g4ajlrMGwxbTJuM280cDVxNnI3czh0OXUiLCJvcmlnaW5fanRpIjoiYjZjN2Q4ZTktZjBhMS00MmIzLThjZDQtZTVmNmE3YjhjOWQwIiwiZXZlbnRfaWQiOiJhNWI2YzdkOC1lOWYwLTQxYTItN2JjMy1kNGU1ZjZhN2I4YzkiLCJ0b2tlbl91c2UiOiJhY2Nlc3MiLCJzY29wZSI6ImF3cy5jb2duaXRvLnNpZ25pbi51c2VyLmFkbWluIiwiYXV0aF90a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6MTcwMDAwMDAwMCwianRpIjoiYzFkMmUzZjQtZzVoNi00N2k4LTg5ajAtZGVmZ2gxMjM0aTU2IiwidXNlcm5hbWUiOiJzYW1wbGUtdXNlci03ZjhhOWJjZC0xZTJmLTNnNGgtNWk2ai03azhsOW0wbjFvMnAifQ.VGhpc0lzQVJhbmRvbVNpZ25hdHVyZVRoYXRJc05vdFZhbGlkQW5kU2hvdWxkTm90QmVVc2VkSW5Qcm9kdWN0aW9uRW52aXJvbm1lbnRzVGhpc0lzQU1vY2tFeGFtcGxlRm9yRG9jdW1lbnRhdGlvblB1cnBvc2VzT25seVBsZWFzZUdlbmVyYXRlWW91ck93blJlYWxUb2tlbkZyb21Db2duaXRvSW5Qcm9kdWN0aW9uRW52aXJvbm1lbnRzTm90VGhpc0V4YW1wbGU",
"expires_in": 900,
"token_type": "Bearer"
}{
"message": "<string>",
"errors": [
"<string>"
]
}{
"message": "<string>",
"errors": [
"<string>"
]
}{
"message": "<string>",
"errors": [
"<string>"
]
}{
"message": "<string>",
"errors": [
"<string>"
]
}Exchanges client credentials (client ID and client secret) for an access token using HTTP Basic Authentication. The client ID is used as the username and the client secret as the password, encoded as Base64 in the format: Basic base64(clientId:clientSecret).
Authorization is done using the “Basic” format within the “Authorization” header. Assuming client id is “sean@example.com” and client secret is “MyVeryCoolSecretPleaseDontSteal”, the format of the unencoded string is as follows:
Then base64 encode the string (in javascript this is Window: btoa() method - Web APIs | MDN) to get the following:
This can be done in the browser console with the methods
sean@example.com:MyVeryCoolSecretPleaseDontSteal
c2VhbkBleGFtcGxlLmNvbTpNeVZlcnlDb29sU2VjcmV0UGxlYXNlRG9udFN0ZWFs
btoa() and atob() to confirm these values during testing.
> btoa('sean@example.com:MyVeryCoolSecretPleaseDontSteal')
'c2VhbkBleGFtcGxlLmNvbTpNeVZlcnlDb29sU2VjcmVOUGxLYXNIRG9udFNOZWFs'
> atob('c2VhbkBleGFtcG×lLmNvbTpNeVZlcnlDb29sU2VjcmV0UGxlYXNIRG9udFNZWFs')
'sean@example.com:MyVeryCoolSecretPleaseDontSteal'
Authorizations
HTTP Basic authentication for the token endpoint. Use the client ID as the username and the client secret as the password.
Body
application/json
Client credentials for OAuth2 client credentials flow.
OAuth2 grant type
Available options:
client_credentials Response
Successfully authenticated and token issued
JWT access token
Token expiration time in seconds. Currently all tokens generated last 15 minutes.
Type of the token
Available options:
Bearer JWT access token
Token expiration time in seconds. Currently all tokens generated last 15 minutes.
Type of the token
Available options:
Bearer