1

I am trying to follow the documentation of ory login flow and in the "implementing the login" flow https://www.ory.sh/docs/hydra/guides/login#implementing-the-login-html-form page there is a node example, and on the last import line it imports AdminApi from @ory/hydra-client

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

but I did the exact thing on in my express/node code, but got the error :

"@ory/hydra-client" has no exported member 'AdminApi' 

I am using the newest version of @ory/hydra-client which I assume should be the version to use?

(link : https://www.npmjs.com/package/@ory/hydra-client?activeTab=readme)

does anyone have an idea on why this is happening?

enter image description here

securenova
  • 482
  • 1
  • 9
  • 25
  • 1
    It looks like there's an undocumented breaking change. Their [changelog has a lot of stuff](https://github.com/ory/hydra/blob/master/CHANGELOG.md#breaking-changes) that hasn't made it to their docs yet. [This issue](https://github.com/ory/sdk/issues/228) was resolved by pointing to that changelog, but the changelog doesn't explain how to migrate to the new API. But [this commit](https://github.com/ory/docs/pull/666/files) might be useful in figuring things out — it looks like they generate all their API clients from ([here](https://github.com/ory/sdk/tree/master/clients/hydra/typescript)). – Zac Anger Jan 16 '23 at 03:26

1 Answers1

0

You can use OAuth2Api instead:

import { Configuration, OAuth2Api } from "@ory/hydra-client";

const publicApi = new OAuth2Api(
  new Configuration({
    basePath: "HYDRA_PUBLIC_URL",
  })
);

const adminApi = new OAuth2Api(
  new Configuration({
    basePath: "HYDRA_ADMIN_URL",
  })
);

Replace HYDRA_PUBLIC_URL and HYDRA_ADMIN_URL with URLs pointing to your own Hydra endpoints.

botosa
  • 1
  • 1