diff --git a/.changeset/cool-bags-appear.md b/.changeset/cool-bags-appear.md new file mode 100644 index 0000000000..f3c2e7fcc3 --- /dev/null +++ b/.changeset/cool-bags-appear.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-components': patch +--- + +Provide a clearer error message when a authentication provider used by the `SignInPage` has not been configured to support sign-in. diff --git a/packages/core-components/src/layout/SignInPage/SignInPage.tsx b/packages/core-components/src/layout/SignInPage/SignInPage.tsx index d64a59158d..a7dc85c4e5 100644 --- a/packages/core-components/src/layout/SignInPage/SignInPage.tsx +++ b/packages/core-components/src/layout/SignInPage/SignInPage.tsx @@ -120,6 +120,11 @@ export const SingleSignInPage = ({ identity = await authApi.getBackstageIdentity({ instantPopup: true, }); + if (!identity) { + throw new Error( + `The ${provider.title} provider is not configured to support sign-in`, + ); + } } if (!identity) { diff --git a/packages/core-components/src/layout/SignInPage/auth0Provider.tsx b/packages/core-components/src/layout/SignInPage/auth0Provider.tsx index 518304d58c..78043cb3fb 100644 --- a/packages/core-components/src/layout/SignInPage/auth0Provider.tsx +++ b/packages/core-components/src/layout/SignInPage/auth0Provider.tsx @@ -33,6 +33,11 @@ const Component: ProviderComponent = ({ onResult }) => { const identity = await auth0AuthApi.getBackstageIdentity({ instantPopup: true, }); + if (!identity) { + throw new Error( + 'The Auth0 provider is not configured to support sign-in', + ); + } const profile = await auth0AuthApi.getProfile(); diff --git a/packages/core-components/src/layout/SignInPage/commonProvider.tsx b/packages/core-components/src/layout/SignInPage/commonProvider.tsx index 0c5d195b1d..3160bd171b 100644 --- a/packages/core-components/src/layout/SignInPage/commonProvider.tsx +++ b/packages/core-components/src/layout/SignInPage/commonProvider.tsx @@ -36,6 +36,11 @@ const Component: ProviderComponent = ({ config, onResult }) => { const identity = await authApi.getBackstageIdentity({ instantPopup: true, }); + if (!identity) { + throw new Error( + `The ${title} provider is not configured to support sign-in`, + ); + } const profile = await authApi.getProfile(); onResult({