<@U04UQ68083H> how can i verify that an "ory_ac_" ...
# ory-copilot
f
@chilly-king-10285 how can i verify that an "ory_ac_" prefix token is correct from an oauth2 perspective?
b
A message from kapa.ai
To verify that an
ory_ac_
prefix token (an OAuth2 authorization code) is correct from an OAuth2 perspective, you should: 1. Understand the Prefix: The
ory_ac_
prefix identifies the token as an OAuth2 authorization code issued by Ory. This prefix is used for easy identification and security scanning, but it is not part of the OAuth2 protocol itself. Only opaque tokens (not JWTs) are prefixed this way [Identifiable token formats](https://www.ory.sh/docs/security-compliance/token-formats). 2. Token Validation Process: - The actual validation of an authorization code is handled by the Ory OAuth2 server (e.g., Ory Hydra) when you exchange the code for an access token at the
/oauth2/token
endpoint. - The server checks that the code: - Exists and is active (not expired or already used). - Was issued to the correct client. - Matches the redirect URI and other parameters. - Has not been revoked or invalidated. 3. No Manual Validation: There is no public API or method to manually validate the structure or signature of an
ory_ac_
code, since it is opaque and only meaningful to the Ory server. The correct way to verify it is to use it in the OAuth2 code exchange flow and let the Ory server perform the validation. 4. Security Note: The Ory server uses advanced token validation, where only the signature is stored in the database, and the full code is required to perform a valid exchange. This means that even if the database is compromised, attackers cannot use the codes without the original value [OAuth 2.0 security overview](https://www.ory.sh/docs/hydra/security-architecture). Summary: To verify an
ory_ac_
authorization code, submit it to the Ory OAuth2 server's
/oauth2/token
endpoint as part of the standard OAuth2 code exchange. The server will handle all necessary validation. There is no way to validate the code manually outside of this process, as the code is opaque and only the Ory server can determine its validity [Identifiable token formats](https://www.ory.sh/docs/security-compliance/token-formats) [OAuth 2.0 security overview](https://www.ory.sh/docs/hydra/security-architecture).