Skip to main content


In this document you can find code examples for the Ory Hydra JavaScript SDK.


Don't consume the /oauth2/auth and /oauth2/token endpoints using this SDK. Use For more information visit the Using OAuth2 guide.


Missing an example? Please create a feature request and it will be added here.

You can find more auto-generated examples of SDK usage in the API documentation hydra-client.


To install the JavaScript SDK, run:

npm install --save @ory/hydra-client

Basic configuration

import { Configuration, PublicApi, AdminApi } from "@ory/hydra-client"

const hydraPublic = new PublicApi(
new Configuration({
basePath: "https://public.hydra:4444/",

const hydraAdmin = new AdminApi(
new Configuration({
basePath: "https://public.hydra:4445/",