Skip to content
This repository was archived by the owner on Sep 30, 2026. It is now read-only.
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
84 changes: 29 additions & 55 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"long": "5.3.2",
"nice-grpc": "2.1.17",
"node-rsa": "2.0.0",
"openid-client": "5.7.1",
"openid-client": "6.8.8",
"protobufjs": "8.8.0"
}
}
8 changes: 4 additions & 4 deletions src/credentials/service-account.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { importPKCS8, SignJWT } from 'jose';
import NodeRSA from 'node-rsa';
import { Issuer, TokenSet } from 'openid-client';
import { discovery, type TokenEndpointResponse } from 'openid-client';

type ServiceAccountJson = {
userId: string;
Expand Down Expand Up @@ -156,12 +156,12 @@ export class ServiceAccount {
public async authenticate(audience: string, options?: AuthenticationOptions): Promise<string> {
const { default: axios } = await import('axios');

const issuer = await Issuer.discover(audience);
const tokenEndpoint = issuer.metadata.token_endpoint ?? 'N/A';
const config = await discovery(new URL(audience), this.userId);
const tokenEndpoint = config.serverMetadata().token_endpoint ?? 'N/A';

const jwt = await this.getSignedJwt(audience);

const response = await axios.post<TokenSet>(
const response = await axios.post<TokenEndpointResponse>(
tokenEndpoint,
new URLSearchParams({
assertion: jwt,
Expand Down
Loading