const stytch = require('stytch');
const client = new stytch.B2BClient({
project_id: '${projectId}',
secret: '${secret}',
custom_base_url: '${projectDomain}',
});
const params = {
token: 'eyJ...',
};
const options = {
authorization_check: {
organization_id: '${organizationId}',
resource_id: 'documents',
action: 'create',
},
};
client.idp
.introspectTokenLocal(params, options)
.then((resp) => {
console.log(resp);
})
.catch((err) => {
console.log(err);
});
package main
import (
"context"
"log"
"github.com/stytchauth/stytch-go/v16/stytch/b2b/b2bstytchapi"
"github.com/stytchauth/stytch-go/v16/stytch/b2b/idp"
)
func main() {
client, err := b2bstytchapi.NewClient(
"${projectId}",
"${secret}",
b2bstytchapi.WithBaseURI("${projectDomain}"),
)
if err != nil {
log.Fatalf("error instantiating client: %v", err)
}
resp, err := client.IDP.IntrospectTokenLocal(context.Background(), &idp.IntrospectTokenLocalParams{
Token: "eyJ...",
})
if err != nil {
log.Fatalf("error in method call: %v", err)
}
log.Println(resp)
}
from stytch import B2BClient
from stytch.b2b.models.sessions import AuthorizationCheck
client = B2BClient(
project_id="${projectId}",
secret="${secret}",
custom_base_url="${projectDomain}",
)
resp = client.idp.introspect_token_local(
token="eyJ...",
authorization_check=AuthorizationCheck(
organization_id='${organizationId}',
resource_id='documents',
action='create'
),
)
print(resp)
require 'stytch'
client = StytchB2B::Client.new(
project_id: '${projectId}',
secret: '${secret}',
custom_base_url: '${projectDomain}',
)
resp = client.idp.introspect_token_local(
token="eyJ...",
)
print(resp)
{
"subject": "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
"scope": "openid email profile",
"audience": ["PROJECT_ID"],
"client_id": "connected-app-test-d731954d-dab3-4a2b-bdee-07f3ad1be888",
"expires_at": 1738848103,
"issued_at": 1738844503,
"issuer": "https://${projectDomain}",
"token_type": "access_token"
}
const stytch = require('stytch');
const client = new stytch.B2BClient({
project_id: '${projectId}',
secret: '${secret}',
custom_base_url: '${projectDomain}',
});
const params = {
token: 'eyJ...',
};
const options = {
authorization_check: {
organization_id: '${organizationId}',
resource_id: 'documents',
action: 'create',
},
};
client.idp
.introspectTokenLocal(params, options)
.then((resp) => {
console.log(resp);
})
.catch((err) => {
console.log(err);
});
package main
import (
"context"
"log"
"github.com/stytchauth/stytch-go/v16/stytch/b2b/b2bstytchapi"
"github.com/stytchauth/stytch-go/v16/stytch/b2b/idp"
)
func main() {
client, err := b2bstytchapi.NewClient(
"${projectId}",
"${secret}",
b2bstytchapi.WithBaseURI("${projectDomain}"),
)
if err != nil {
log.Fatalf("error instantiating client: %v", err)
}
resp, err := client.IDP.IntrospectTokenLocal(context.Background(), &idp.IntrospectTokenLocalParams{
Token: "eyJ...",
})
if err != nil {
log.Fatalf("error in method call: %v", err)
}
log.Println(resp)
}
from stytch import B2BClient
from stytch.b2b.models.sessions import AuthorizationCheck
client = B2BClient(
project_id="${projectId}",
secret="${secret}",
custom_base_url="${projectDomain}",
)
resp = client.idp.introspect_token_local(
token="eyJ...",
authorization_check=AuthorizationCheck(
organization_id='${organizationId}',
resource_id='documents',
action='create'
),
)
print(resp)
require 'stytch'
client = StytchB2B::Client.new(
project_id: '${projectId}',
secret: '${secret}',
custom_base_url: '${projectDomain}',
)
resp = client.idp.introspect_token_local(
token="eyJ...",
)
print(resp)
{
"subject": "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
"scope": "openid email profile",
"audience": ["PROJECT_ID"],
"client_id": "connected-app-test-d731954d-dab3-4a2b-bdee-07f3ad1be888",
"expires_at": 1738848103,
"issued_at": 1738844503,
"issuer": "https://${projectDomain}",
"token_type": "access_token"
}
Methods
Authenticate Access Token (Local)
Authenticate a Connected App access token.
const stytch = require('stytch');
const client = new stytch.B2BClient({
project_id: '${projectId}',
secret: '${secret}',
custom_base_url: '${projectDomain}',
});
const params = {
token: 'eyJ...',
};
const options = {
authorization_check: {
organization_id: '${organizationId}',
resource_id: 'documents',
action: 'create',
},
};
client.idp
.introspectTokenLocal(params, options)
.then((resp) => {
console.log(resp);
})
.catch((err) => {
console.log(err);
});
package main
import (
"context"
"log"
"github.com/stytchauth/stytch-go/v16/stytch/b2b/b2bstytchapi"
"github.com/stytchauth/stytch-go/v16/stytch/b2b/idp"
)
func main() {
client, err := b2bstytchapi.NewClient(
"${projectId}",
"${secret}",
b2bstytchapi.WithBaseURI("${projectDomain}"),
)
if err != nil {
log.Fatalf("error instantiating client: %v", err)
}
resp, err := client.IDP.IntrospectTokenLocal(context.Background(), &idp.IntrospectTokenLocalParams{
Token: "eyJ...",
})
if err != nil {
log.Fatalf("error in method call: %v", err)
}
log.Println(resp)
}
from stytch import B2BClient
from stytch.b2b.models.sessions import AuthorizationCheck
client = B2BClient(
project_id="${projectId}",
secret="${secret}",
custom_base_url="${projectDomain}",
)
resp = client.idp.introspect_token_local(
token="eyJ...",
authorization_check=AuthorizationCheck(
organization_id='${organizationId}',
resource_id='documents',
action='create'
),
)
print(resp)
require 'stytch'
client = StytchB2B::Client.new(
project_id: '${projectId}',
secret: '${secret}',
custom_base_url: '${projectDomain}',
)
resp = client.idp.introspect_token_local(
token="eyJ...",
)
print(resp)
{
"subject": "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
"scope": "openid email profile",
"audience": ["PROJECT_ID"],
"client_id": "connected-app-test-d731954d-dab3-4a2b-bdee-07f3ad1be888",
"expires_at": 1738848103,
"issued_at": 1738844503,
"issuer": "https://${projectDomain}",
"token_type": "access_token"
}
const stytch = require('stytch');
const client = new stytch.B2BClient({
project_id: '${projectId}',
secret: '${secret}',
custom_base_url: '${projectDomain}',
});
const params = {
token: 'eyJ...',
};
const options = {
authorization_check: {
organization_id: '${organizationId}',
resource_id: 'documents',
action: 'create',
},
};
client.idp
.introspectTokenLocal(params, options)
.then((resp) => {
console.log(resp);
})
.catch((err) => {
console.log(err);
});
package main
import (
"context"
"log"
"github.com/stytchauth/stytch-go/v16/stytch/b2b/b2bstytchapi"
"github.com/stytchauth/stytch-go/v16/stytch/b2b/idp"
)
func main() {
client, err := b2bstytchapi.NewClient(
"${projectId}",
"${secret}",
b2bstytchapi.WithBaseURI("${projectDomain}"),
)
if err != nil {
log.Fatalf("error instantiating client: %v", err)
}
resp, err := client.IDP.IntrospectTokenLocal(context.Background(), &idp.IntrospectTokenLocalParams{
Token: "eyJ...",
})
if err != nil {
log.Fatalf("error in method call: %v", err)
}
log.Println(resp)
}
from stytch import B2BClient
from stytch.b2b.models.sessions import AuthorizationCheck
client = B2BClient(
project_id="${projectId}",
secret="${secret}",
custom_base_url="${projectDomain}",
)
resp = client.idp.introspect_token_local(
token="eyJ...",
authorization_check=AuthorizationCheck(
organization_id='${organizationId}',
resource_id='documents',
action='create'
),
)
print(resp)
require 'stytch'
client = StytchB2B::Client.new(
project_id: '${projectId}',
secret: '${secret}',
custom_base_url: '${projectDomain}',
)
resp = client.idp.introspect_token_local(
token="eyJ...",
)
print(resp)
{
"subject": "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
"scope": "openid email profile",
"audience": ["PROJECT_ID"],
"client_id": "connected-app-test-d731954d-dab3-4a2b-bdee-07f3ad1be888",
"expires_at": 1738848103,
"issued_at": 1738844503,
"issuer": "https://${projectDomain}",
"token_type": "access_token"
}
Examine and introspect an access token locally. All standard and custom claims will be returned. No network calls are made when invoking this API method.
An error will be thrown if the token is not active.
This method supports only access tokens.
If an
authorization_check object is passed in, this method will also check if the token contains scopes that are authorized to perform the specified action on the resource_id in the specified Organization.
Body
Response
The issuer of the token. This is the domain of your project, e.g. https://$ by default, or stytch.com/PROJECT_ID if the token was retrieved using the stytch.com domain. See the Custom Domain guide for more information.