<@U04UQ68083H> Could you provide an example of how...
# ory-copilot
b
@chilly-king-10285 Could you provide an example of how signed JWTs can be used with Ory?
c
A message from kapa.ai
Sure, Ory supports the use of signed JSON Web Tokens (JWTs) in several ways. Here are a few examples: 1. JWT for OAuth 2.0 Client Authentication and Authorization Grants: This is an extension to the OAuth2 framework that allows a client to send a signed JWT token to an OpenID Connect Provider in exchange for an OAuth 2.0 access token. For instance, an electric company (ELECTRO) can send a signed JWT token with the required claims to the OpenID Connect Provider configured for an online bank to request an OAuth 2.0 access token each month. ELECTRO can then use the access token to cash the monthly payments from the online bank. [source](https://www.ory.sh/docs/hydra/guides/jwt) 2. JWT Bearer Grant Type mechanism: This is similar to Basic and Body Authentication, but instead of sending the client ID and client secret, the client sends a JWT which was signed by its cryptographic key. To create a client capable of using the JWT Bearer Grant Type mechanism with Ory, you can use the following CLI command:
Copy code
bash ory create oauth2-client --project "$project_id" \    --name "Client Credentials Demo" \    --grant-type client_credentials \    --token-endpoint-auth-method private_key_jwt \    --jwks-uri <https://example.org/path/to/clients/public_key_set.jwks>
[source](https://www.ory.sh/docs/oauth2-oidc/client-credentials#jwt-bearer-profile-for-oauth2-client-authentication) 3. JWTs for client authentication: Ory supports OAuth 2.0 Client Authentication with RSA and ECDSA private/public key pairs and supports signing algorithms such as RS256, RS384, RS512, PS256, PS384, PS512, ES256, ES384, ES512, and EdDSA. Instead of sending the
client_id
and
client_secret
, you authenticate the client with a signed JWT. To use this feature for a specific OAuth 2.0 Client, set the
token_endpoint_auth_method
to
private_key_jwt
and register the public key of the RSA/ECDSA signing key either using the
jwks_uri
or
jwks
fields of the client. [source](https://www.ory.sh/docs/hydra/guides/jwt#jwts-for-client-authentication) 4. Ory Proxy with JWTs: The token contains all session and identity information linked to the Ory Session Cookie. This is an example of a JWT with session and identity data. [source](https://www.ory.sh/docs/guides/cli/proxy-and-tunnel#use-ory-proxy-with-json-web-tokens) Remember to always ensure that your JWTs are securely signed and that the signing key is kept private.