n1ru4l / envelop

Envelop is a lightweight library allowing developers to easily develop, share, collaborate and extend their GraphQL execution layer. Envelop is the missing GraphQL plugin system.
https://envelop.dev
MIT License
777 stars 126 forks source link

Envelop Auth0 plugin only accepts a single audience string when it should also accept an array of audiences #2199

Closed KurtMar closed 3 months ago

KurtMar commented 5 months ago

Issue workflow progress

Progress of the issue based on the Contributor Workflow


Describe the bug

The Auth0 plugin only accepts a single audience when the underlying jsonwebtoken library also accepts (among others) an array of string and actually internally creates an array from a single audience if provided.

To Reproduce

No reproduction.

See jsonwebtoken project for how the property is handled to see that it can in fact receive an array: https://github.com/auth0/node-jsonwebtoken/blob/bc28861f1fa981ed9c009e29c044a19760a0b128/verify.js#L195

Compare to the envelop auth0 plugin: https://github.com/n1ru4l/envelop/blob/eafae3bf93a19f2e41efcadcc1c42fb99ba08b52/packages/plugins/auth0/src/index.ts#L12

Expected behavior

Allow passing an array of strings to the function. Preferably whatever the jsonwebtoken types indicate, which is currently: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/518b9ae4a518c621700a97be30ee128b66a5da78/types/jsonwebtoken/index.d.ts#L60

audience?: string | RegExp | Array<string | RegExp> | undefined;

Environment:

Additional context

NA

EmrysMyrddin commented 3 months ago

Fixed by #2200