docs icon indicating copy to clipboard operation
docs copied to clipboard

TS: apikey/accessToken not included in requests

Open joshbalfour opened this issue 2 years ago • 5 comments

Preflight checklist

Describe the bug

apiKey/accessToken does not get added to the request when using the typescript SDK, resulting in admin calls rejecting as unauthorised.

You can work around it if you set the baseOptions to specify the header yourself.

Reproducing the bug

const hydra = new OAuth2Api(new Configuration({
  basePath: 'https://slug.projects.oryapis.com/',
  apiKey: 'ory_pat_xyz',
}))
hydra.listOAuth2Clients().then(console.log).catch(console.error)

Relevant log output

{
    "error": {
        "code": 401,
        "status": "Unauthorized",
        "request": "e5490b83-f7d5-9399-8136-283766c823b4",
        "message": "Access credentials are invalid"
    }
}

Relevant configuration

No response

Version

"@ory/hydra-client": "^2.0.2"

On which operating system are you observing this issue?

Ory Network

In which environment are you deploying?

Ory Network

Additional Context

No response

joshbalfour avatar Mar 17 '23 10:03 joshbalfour