Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump openid-client from 5.6.5 to 6.1.7 #54

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
ConsumerConfig as BaseConsumerConfig,
ProducerConfig,
} from 'kafkajs'
import { Issuer } from 'openid-client'
import { clientCredentialsGrant, Configuration } from 'openid-client'

Check failure on line 14 in index.ts

View workflow job for this annotation

GitHub Actions / install

The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("openid-client")' call instead.
import { randomUUID } from 'crypto'

import { compress, decompress } from '@mongodb-js/zstd'
Expand Down Expand Up @@ -43,22 +43,19 @@
config.ssl ??= true

if (client_id && !config.sasl) {
const issuer = new Issuer({
issuer: domain,
token_endpoint: `https://auth.${domain}/oauth2/token`,
})

const client = new issuer.Client({ client_id, client_secret })
const oidcConfig = new Configuration(
{
issuer: domain,
token_endpoint: `https://auth.${domain}/oauth2/token`,
},
client_id,
client_secret,
)

config.sasl = {
mechanism: 'oauthbearer',
oauthBearerProvider: async () => {
const { access_token } = await client.grant({
grant_type: 'client_credentials',
})
if (!access_token) {
throw new Error('response must contain access_token')
}
const { access_token } = await clientCredentialsGrant(oidcConfig)
return { value: access_token }
},
}
Expand Down
Loading
Loading