Add ability to override github app callback url
By default, the github app provider redirects back to the base url.
This change allows a user to override the GitHub App url using the config field `customCallbackUrl`.
It will look like this in the configuration:
```
auth:
providers:
github:
development:
clientId: SUPER ID
clientSecret: SUPER SECRET
customCallbackUrl: https://some-url.com/callback
```
Signed-off-by: Nicolas Arnold <nic@roadie.io>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-auth-backend': patch
|
||||
---
|
||||
|
||||
Allow users to override callback url of Github provider
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user