<@U04UQ68083H> I'm doing a standard OAuth2 flow to...
# ory-copilot
a
@chilly-king-10285 I'm doing a standard OAuth2 flow to get access, refresh, and ID tokens for my user. When sending this access token to my introspect endpoint through the Hydra SDK I'm getting a null token, containing 'active: false' and all other fields as null. What could be causing this?
c
A message from kapa.ai
The issue you're experiencing could be due to a few reasons: 1. The token has expired or has been revoked. The introspection endpoint checks if a token (both refresh and access) is active or not. An active token is neither expired nor revoked. If a token is active, additional information on the token will be included. If it's not active, it will return 'active: false' and all other fields as null. [source](https://www.ory.sh/docs/hydra/reference/api) 2. The token was not properly issued or there was an error during the token issuance process. You can check the logs for any errors during the token issuance process. 3. The token is not recognized by the system. This could happen if the token was issued by a different system or if there was a system error. To debug this issue, you can use the
/oauth2/token
endpoint to check the validity of the token. If the token is invalid, the endpoint will return an error message. If you need more information for debugging, you can switch the project to development mode to see the
error_debug
field in the response. [source](https://www.ory.sh/docs/hydra/debug#oauth2token-endpoint-fails-for-jwks-based-client) If you're still having issues, you might want to check the implementation of your token introspection function. Here's a sample implementation using the Hydra SDK:
Copy code
javascript import { Configuration, OAuth2Api } from "@ory/client"      const ory = new OAuth2Api(    new Configuration({    basePath: `https://${process.env.ORY_PROJECT_SLUG}.<http://projects.oryapis.com|projects.oryapis.com>`,    accessToken: process.env.ORY_API_KEY,    }),   )      export async function introspectToken(accessToken: string) {    const { data } = await ory.introspectOAuth2Token({ token: accessToken })    data.active // true or false   }
[source](https://www.ory.sh/docs/hydra/guides/oauth2-token-introspection)