Skip to main content
POST
/
oauth
/
token
Token Endpoint
curl --request POST \
  --url https://eu.phrase.com/idm/oauth/token \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data 'grant_type=<string>' \
  --data 'subject_token=<string>' \
  --data 'resource=<string>' \
  --data 'audience=<string>' \
  --data 'scope=<string>' \
  --data requested_token_type=urn:ietf:params:oauth:token-type:access_token \
  --data subject_token_type=urn:phrase:params:oauth:token-type:api_token \
  --data 'actor_token=<string>' \
  --data 'actor_token_type=<string>'
import requests

url = "https://eu.phrase.com/idm/oauth/token"

payload = {
    "grant_type": "<string>",
    "subject_token": "<string>",
    "resource": "<string>",
    "audience": "<string>",
    "scope": "<string>",
    "requested_token_type": "urn:ietf:params:oauth:token-type:access_token",
    "subject_token_type": "urn:phrase:params:oauth:token-type:api_token",
    "actor_token": "<string>",
    "actor_token_type": "<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({
    grant_type: '<string>',
    subject_token: '<string>',
    resource: '<string>',
    audience: '<string>',
    scope: '<string>',
    requested_token_type: 'urn:ietf:params:oauth:token-type:access_token',
    subject_token_type: 'urn:phrase:params:oauth:token-type:api_token',
    actor_token: '<string>',
    actor_token_type: '<string>'
  })
};

fetch('https://eu.phrase.com/idm/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://eu.phrase.com/idm/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=%3Cstring%3E&subject_token=%3Cstring%3E&resource=%3Cstring%3E&audience=%3Cstring%3E&scope=%3Cstring%3E&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aphrase%3Aparams%3Aoauth%3Atoken-type%3Aapi_token&actor_token=%3Cstring%3E&actor_token_type=%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://eu.phrase.com/idm/oauth/token"

	payload := strings.NewReader("grant_type=%3Cstring%3E&subject_token=%3Cstring%3E&resource=%3Cstring%3E&audience=%3Cstring%3E&scope=%3Cstring%3E&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aphrase%3Aparams%3Aoauth%3Atoken-type%3Aapi_token&actor_token=%3Cstring%3E&actor_token_type=%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://eu.phrase.com/idm/oauth/token")
  .header("Content-Type", "application/x-www-form-urlencoded")
  .body("grant_type=%3Cstring%3E&subject_token=%3Cstring%3E&resource=%3Cstring%3E&audience=%3Cstring%3E&scope=%3Cstring%3E&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aphrase%3Aparams%3Aoauth%3Atoken-type%3Aapi_token&actor_token=%3Cstring%3E&actor_token_type=%3Cstring%3E")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://eu.phrase.com/idm/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=%3Cstring%3E&subject_token=%3Cstring%3E&resource=%3Cstring%3E&audience=%3Cstring%3E&scope=%3Cstring%3E&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aphrase%3Aparams%3Aoauth%3Atoken-type%3Aapi_token&actor_token=%3Cstring%3E&actor_token_type=%3Cstring%3E"

response = http.request(request)
puts response.read_body
{
  "access_token": "<string>",
  "issued_token_type": "<string>",
  "token_type": "<string>",
  "expires_in": 123
}
{
  "error_description": "<string>"
}

Body

application/x-www-form-urlencoded
grant_type
string
required

Type of grant for access token

subject_token
string
required

Token of the subject

resource
string

Target resource URI (not supported)

audience
string

Logical name of the target service (not supported)

scope
string

space-delimited, case-sensitive list of requested grants (not supported)

requested_token_type
string
default:urn:ietf:params:oauth:token-type:access_token

Token type requested

subject_token_type
string
default:urn:phrase:params:oauth:token-type:api_token

Type of the token (not supported)

actor_token
string

Acting party token (not supported)

actor_token_type
string

Type of the actor token (not supported)

Response

Token is issued to the caller

access_token
string
required

Access token for oauth

issued_token_type
string
required

Type of the access_token (RFC-8693)

token_type
string
required

Token type - defines how the token should be used

expires_in
integer
required

Number of seconds the access token is valid