Skip to main content

JavaScript

In this document you can find code examples for a self-hosted Ory Hydra JavaScript SDK.

info

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

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

danger

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

Installation

To install the JavaScript SDK, run:

npm install --save @ory/client

Configuration

Basic configuration

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

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

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