Skip to main content

Ory OAuth2 & OpenID Connect JavaScript SDK

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

info

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

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 oryPublic = new PublicApi(
new Configuration({
basePath: "https://$PROJECT_SLUG.projects.oryapis.com/",
}),
)

const oryAdmin = new AdminApi(
new Configuration({
basePath: "https://$PROJECT_SLUG.projects.oryapis.com/",
}),
)