Skip to content

TS: apikey/accessToken not included in requests #1932

Open
@joshbalfour

Description

@joshbalfour

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions