From 1609e79eaecfa929287d80607d9358973a5721e8 Mon Sep 17 00:00:00 2001 From: Hellgren Heikki Date: Mon, 20 Oct 2025 08:54:48 +0300 Subject: [PATCH] feat(auth): use app title in consent screen use `app.title` instead hard-coded 'Backstage' in the consent screen Signed-off-by: Hellgren Heikki --- .changeset/tender-regions-know.md | 5 +++++ .../components/ConsentPage/ConsentPage.tsx | 21 +++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 .changeset/tender-regions-know.md diff --git a/.changeset/tender-regions-know.md b/.changeset/tender-regions-know.md new file mode 100644 index 0000000000..8f59567597 --- /dev/null +++ b/.changeset/tender-regions-know.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-auth': patch +--- + +Authentication content screen now uses application title. diff --git a/plugins/auth/src/components/ConsentPage/ConsentPage.tsx b/plugins/auth/src/components/ConsentPage/ConsentPage.tsx index 0f071025a2..859d82fe04 100644 --- a/plugins/auth/src/components/ConsentPage/ConsentPage.tsx +++ b/plugins/auth/src/components/ConsentPage/ConsentPage.tsx @@ -19,11 +19,11 @@ import { Box, Button, Card, - CardContent, CardActions, - Typography, - makeStyles, + CardContent, Divider, + makeStyles, + Typography, } from '@material-ui/core'; import { Alert } from '@material-ui/lab'; import CheckCircleIcon from '@material-ui/icons/CheckCircle'; @@ -31,14 +31,15 @@ import CancelIcon from '@material-ui/icons/Cancel'; import AppsIcon from '@material-ui/icons/Apps'; import WarningIcon from '@material-ui/icons/Warning'; import { + Content, + EmptyState, Header, Page, - Content, Progress, - EmptyState, ResponseErrorPanel, } from '@backstage/core-components'; import { useConsentSession } from './useConsentSession'; +import { configApiRef, useApi } from '@backstage/frontend-plugin-api'; const useStyles = makeStyles(theme => ({ authCard: { @@ -100,6 +101,8 @@ export const ConsentPage = () => { const classes = useStyles(); const { sessionId } = useParams<{ sessionId: string }>(); const { state, handleAction } = useConsentSession({ sessionId }); + const configApi = useApi(configApiRef); + const appTitle = configApi.getOptionalString('app.title') ?? 'Backstage'; if (!sessionId) { return ( @@ -158,8 +161,8 @@ export const ConsentPage = () => { {state.action === 'approve' - ? 'You have successfully authorized the application to access your Backstage account.' - : 'You have denied the application access to your Backstage account.'} + ? `You have successfully authorized the application to access your ${appTitle} account.` + : `You have denied the application access to your ${appTitle} account.`} Redirecting to the application... @@ -184,7 +187,7 @@ export const ConsentPage = () => { {appName} - wants to access your Backstage account + wants to access your {appTitle} account @@ -198,7 +201,7 @@ export const ConsentPage = () => { > Security Notice: By authorizing this application, - you are granting it access to your Backstage account. The + you are granting it access to your {appTitle} account. The application will receive an access token that allows it to act on your behalf.