diff --git a/.changeset/pretty-feet-explode.md b/.changeset/pretty-feet-explode.md new file mode 100644 index 0000000000..c5cf0beb00 --- /dev/null +++ b/.changeset/pretty-feet-explode.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-auth-backend': patch +--- + +Allow users to override callback url of Github provider diff --git a/plugins/auth-backend/src/providers/github/provider.ts b/plugins/auth-backend/src/providers/github/provider.ts index b6b198b644..8abd4c76ea 100644 --- a/plugins/auth-backend/src/providers/github/provider.ts +++ b/plugins/auth-backend/src/providers/github/provider.ts @@ -223,6 +223,9 @@ export const createGithubProvider = ( const enterpriseInstanceUrl = envConfig.getOptionalString( 'enterpriseInstanceUrl', ); + const customCallbackUrl = envConfig.getOptionalString( + 'customCallbackUrl', + ); const authorizationUrl = enterpriseInstanceUrl ? `${enterpriseInstanceUrl}/login/oauth/authorize` : undefined; @@ -232,7 +235,8 @@ export const createGithubProvider = ( const userProfileUrl = enterpriseInstanceUrl ? `${enterpriseInstanceUrl}/api/v3/user` : undefined; - const callbackUrl = `${globalConfig.baseUrl}/${providerId}/handler/frame`; + const callbackUrl = customCallbackUrl || + `${globalConfig.baseUrl}/${providerId}/handler/frame`; const catalogIdentityClient = new CatalogIdentityClient({ catalogApi,