Version: v1.5

JavaScript

The JavaScript SDK is autogenerated and developer experience is not great. We encourage you to use fetch instead.

To install the JavaScript SDK, run:

npm install --save @oryd/hydra-client

Configuration

Basic configuration

const Hydra = require('@oryd/hydra-client')
// Set this to Hydra's URL
Hydra.ApiClient.instance.basePath = 'http://localhost:4445'

API Usage

const hydra = new Hydra.AdminAPI()
// for example, let's fetch all OAuth2 clients
hydra.listOAuth2Clients((error, data, response) => {
if (error) {
// a network error occurred.
throw error
} else if (response.statusCode < 200 || response.statusCode >= 400) {
// an application error occurred.
throw new Error(
'Consent endpoint gave status code ' +
response.statusCode +
', but status code 200 was expected.'
)
}
console.log(response) // a list of OAuth2 clients.
})

API Docs

API docs are available here. Please note that those docs are generated and may introduce bugs if code examples are used 1:1. Especially the package name is not correct.

Last updated on by aeneasr