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

199 Views Asked by At

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

1

There are 1 best solutions below

0
On

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.