From e4ad29ad8b4d84590b81519f5382ad7e15383e1c Mon Sep 17 00:00:00 2001 From: Stephen Glass Date: Mon, 29 Jul 2024 15:16:31 -0400 Subject: [PATCH] add changeset Signed-off-by: Stephen Glass --- .changeset/violet-beds-promise.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .changeset/violet-beds-promise.md diff --git a/.changeset/violet-beds-promise.md b/.changeset/violet-beds-promise.md new file mode 100644 index 0000000000..9fa03646c4 --- /dev/null +++ b/.changeset/violet-beds-promise.md @@ -0,0 +1,17 @@ +--- +'@backstage/core-components': patch +'@backstage/core-plugin-api': patch +'@backstage/app-defaults': patch +'@backstage/core-app-api': patch +'@backstage/plugin-auth-backend': patch +'@backstage/plugin-auth-node': patch +--- + +Fix error handling using authentication redirect flow via `enableExperimentalRedirectFlow` config. If an error is caught during authentication, the user is redirected back to app origin with `?error=true` query parameter. A cookie is also set in the redirect which contains the error message. The error can be fetched from any custom sign in page using the new `AuthErrorApi` and `getSignInError()` implementation. Example: + +```ts +import { useApi, authErrorApiRef } from '@backstage/core-plugin-api'; + +const authErrorApi = useApi(authErrorApiRef); +const errorResponse = await authErrorApi.getSignInAuthError(); +```