OpenID Connect
Introspect Token
Get information about an access token.
POST
/
v1
/
oauth2
/
introspect
Go (SDK)
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.Oauth2.Introspect(ctx, components.IntrospectTokenRequest{
Token: "<value>",
ClientID: "<id>",
ClientSecret: "<value>",
})
if err != nil {
log.Fatal(err)
}
if res.IntrospectTokenResponse != nil {
// handle response
}
}from polar_sdk import Polar
with Polar() as polar:
res = polar.oauth2.introspect(request={
"token": "<value>",
"client_id": "<id>",
"client_secret": "<value>",
})
# Handle response
print(res)import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.oauth2.introspect({
token: "<value>",
clientId: "<id>",
clientSecret: "<value>",
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Components;
$sdk = Polar\Polar::builder()->build();
$request = new Components\IntrospectTokenRequest(
token: '<value>',
clientId: '<id>',
clientSecret: '<value>',
);
$response = $sdk->oauth2->introspect(
request: $request
);
if ($response->introspectTokenResponse !== null) {
// handle response
}curl --request POST \
--url https://api.polar.sh/v1/oauth2/introspect \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'token=<string>' \
--data 'client_id=<string>' \
--data 'client_secret=<string>'const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({token: '<string>', client_id: '<string>', client_secret: '<string>'})
};
fetch('https://api.polar.sh/v1/oauth2/introspect', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.polar.sh/v1/oauth2/introspect")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("token=%3Cstring%3E&client_id=%3Cstring%3E&client_secret=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/oauth2/introspect")
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 = "token=%3Cstring%3E&client_id=%3Cstring%3E&client_secret=%3Cstring%3E"
response = http.request(request)
puts response.read_body{
"active": true,
"client_id": "<string>",
"scope": "<string>",
"sub": "<string>",
"aud": "<string>",
"iss": "<string>",
"exp": 123,
"iat": 123
}Body
application/x-www-form-urlencoded
Response
200 - application/json
Successful Response
Available options:
access_token, refresh_token Available options:
user, organization Was this page helpful?
⌘I
Go (SDK)
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.Oauth2.Introspect(ctx, components.IntrospectTokenRequest{
Token: "<value>",
ClientID: "<id>",
ClientSecret: "<value>",
})
if err != nil {
log.Fatal(err)
}
if res.IntrospectTokenResponse != nil {
// handle response
}
}from polar_sdk import Polar
with Polar() as polar:
res = polar.oauth2.introspect(request={
"token": "<value>",
"client_id": "<id>",
"client_secret": "<value>",
})
# Handle response
print(res)import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.oauth2.introspect({
token: "<value>",
clientId: "<id>",
clientSecret: "<value>",
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Components;
$sdk = Polar\Polar::builder()->build();
$request = new Components\IntrospectTokenRequest(
token: '<value>',
clientId: '<id>',
clientSecret: '<value>',
);
$response = $sdk->oauth2->introspect(
request: $request
);
if ($response->introspectTokenResponse !== null) {
// handle response
}curl --request POST \
--url https://api.polar.sh/v1/oauth2/introspect \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'token=<string>' \
--data 'client_id=<string>' \
--data 'client_secret=<string>'const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({token: '<string>', client_id: '<string>', client_secret: '<string>'})
};
fetch('https://api.polar.sh/v1/oauth2/introspect', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.polar.sh/v1/oauth2/introspect")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("token=%3Cstring%3E&client_id=%3Cstring%3E&client_secret=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/oauth2/introspect")
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 = "token=%3Cstring%3E&client_id=%3Cstring%3E&client_secret=%3Cstring%3E"
response = http.request(request)
puts response.read_body{
"active": true,
"client_id": "<string>",
"scope": "<string>",
"sub": "<string>",
"aud": "<string>",
"iss": "<string>",
"exp": 123,
"iat": 123
}
