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
}
Get information about an access token.
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
}
You can generate an Organization Access Token from your organization's settings.
Successful Response
The response is of type object
.
Was this page helpful?