From 018b7ec1f3171dba66f7a787952c8fe07e1c1ad6 Mon Sep 17 00:00:00 2001 From: Joe Patterson Date: Thu, 8 Sep 2022 20:33:54 +1000 Subject: [PATCH] update provider for changes in review and update changeset message Signed-off-by: Joe Patterson --- .changeset/smart-sloths-search.md | 2 +- plugins/auth-backend/src/providers/auth0/provider.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.changeset/smart-sloths-search.md b/.changeset/smart-sloths-search.md index 4b69184fa6..fe7565844e 100644 --- a/.changeset/smart-sloths-search.md +++ b/.changeset/smart-sloths-search.md @@ -2,4 +2,4 @@ '@backstage/plugin-auth-backend': minor --- -Converts the auth0 to the passport-auth0 package and allows the addition of audience to auth0 connections this means that you can connect to the correct API to get permissions, access tokens and full profile +The auth0 integration is updated to use the passport-auth0 library. The configuration under auth.providers.auth0.* now supports an optional audience parameter; providing that allows you to connect to the correct API to get permissions, access tokens, and full profile information. diff --git a/plugins/auth-backend/src/providers/auth0/provider.ts b/plugins/auth-backend/src/providers/auth0/provider.ts index 5df37313f3..309fb0fc7b 100644 --- a/plugins/auth-backend/src/providers/auth0/provider.ts +++ b/plugins/auth-backend/src/providers/auth0/provider.ts @@ -70,7 +70,7 @@ export class Auth0AuthProvider implements OAuthHandlers { * so that the 'state' parameter of the oauth2 flow can be stored. * This implementation of StateStore matches the NullStore found within * passport-oauth2, which is the StateStore implementation used when options.state = false, - * allowing us to avoid using express-session in order to integrate with Okta. + * allowing us to avoid using express-session in order to integrate with auth0. */ private store: StateStore = { store(_req: express.Request, cb: any) { @@ -126,7 +126,7 @@ export class Auth0AuthProvider implements OAuthHandlers { prompt: 'consent', scope: req.scope, state: encodeState(req.state), - audience: this.audience as string, + ...(this.audience ? { audience: this.audience } : {}), }); } @@ -135,7 +135,7 @@ export class Auth0AuthProvider implements OAuthHandlers { OAuthResult, PrivateInfo >(req, this._strategy, { - audience: this.audience as string, + ...(this.audience ? { audience: this.audience } : {}), }); return {