<@U04UQ68083H> Is it possible to create a client w...
# ory-copilot
r
@chilly-king-10285 Is it possible to create a client with the hydra api that has a JWT strategy to generate access tokens instead of the default opaque one?
c
A message from kapa.ai
Yes, it is possible to create a client with the Hydra API that has a JWT strategy to generate access tokens instead of the default opaque one. To configure Ory OAuth2 to issue JWT access tokens for a specific client, you'll need to update the client configuration. Here's an example using the Ory Client SDK:
Copy code
javascript import { Configuration, JsonPatch, 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 patchOAuth2Client(id: string, patches: JsonPatch[]) {   await ory.patchOAuth2Client({     id,     jsonPatch: [       ...patches,       {         op: "replace",         path: "access_token_strategy",         value: "jwt",       },     ],   }); }
The setting is also available through the Ory Console under the clients' settings. Source: [https://www.ory.sh/docs/oauth2-oidc/jwt-access-token](https://www.ory.sh/docs/oauth2-oidc/jwt-access-token)
r
What's inside the JsonPatch array? Do you have an example?