POST
/
v1
/
oauth2
/
introspect
package main

import(
	"context"
	"os"
	polargo "github.com/polarsource/polar-go"
	"github.com/polarsource/polar-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := polargo.New(
        polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
    )

    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
    }
}
{
  "active": true,
  "client_id": "<string>",
  "token_type": "access_token",
  "scope": "<string>",
  "sub_type": "user",
  "sub": "<string>",
  "aud": "<string>",
  "iss": "<string>",
  "exp": 123,
  "iat": 123
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/x-www-form-urlencoded
token
string
required
client_id
string
required
client_secret
string
required
token_type_hint
enum<string> | null
Available options:
access_token,
refresh_token

Response

200 - application/json
Successful Response
active
boolean
required
client_id
string
required
token_type
enum<string>
required
Available options:
access_token,
refresh_token
scope
string
required
sub_type
enum<string>
required
Available options:
user,
organization
sub
string
required
aud
string
required
iss
string
required
exp
integer
required
iat
integer
required

Was this page helpful?