Skip to content

Commit

Permalink
feat: support multiple audiences
Browse files Browse the repository at this point in the history
  • Loading branch information
peterphanouvong authored Jan 17, 2024
1 parent e71146d commit 81a5469
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
14 changes: 10 additions & 4 deletions lib/sdk/oauth2-flows/AuthCodeAbstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,6 @@ export abstract class AuthCodeAbstract {
scope: this.config.scope ?? AuthCodeAbstract.DEFAULT_TOKEN_SCOPES,
};

if (this.config.audience) {
searchParamsObject.audience = this.config.audience;
}

if (options.start_page) {
searchParamsObject.start_page = options.start_page;
}
Expand All @@ -275,6 +271,16 @@ export abstract class AuthCodeAbstract {
for (const key in searchParamsObject)
searchParams.append(key, searchParamsObject[key]);

if (this.config.audience) {
this.config.audience
.trim()
.split(/\s+/)
.forEach((aud) => {
urlSearchParams.append('audience', aud);

Check failure on line 279 in lib/sdk/oauth2-flows/AuthCodeAbstract.ts

View workflow job for this annotation

GitHub Actions / main (18.x)

Cannot find name 'urlSearchParams'. Did you mean 'searchParams'?
});
}


return searchParams;
}
}
7 changes: 6 additions & 1 deletion lib/sdk/oauth2-flows/ClientCredentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ export class ClientCredentials {
});

if (this.config.audience) {
searchParams.append('audience', this.config.audience);
this.config.audience
.trim()
.split(/\s+/)
.forEach((aud) => {
urlSearchParams.append('audience', aud);

Check failure on line 122 in lib/sdk/oauth2-flows/ClientCredentials.ts

View workflow job for this annotation

GitHub Actions / main (18.x)

Cannot find name 'urlSearchParams'. Did you mean 'searchParams'?
});
}

return new URLSearchParams(searchParams);
Expand Down

0 comments on commit 81a5469

Please sign in to comment.