Merge pull request #7456 from backstage/rugvip/authmsg

core-components: clearer error message for auth providers without sign-in support
This commit is contained in:
Patrik Oldsberg
2021-10-05 19:50:36 +02:00
committed by GitHub
4 changed files with 20 additions and 0 deletions
+5
View File
@@ -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.
@@ -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) {
@@ -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();
@@ -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({