diff --git a/packages/app/src/App.tsx b/packages/app/src/App.tsx
index fb4e2fd102..ab32eb4021 100644
--- a/packages/app/src/App.tsx
+++ b/packages/app/src/App.tsx
@@ -41,24 +41,52 @@ import { GraphiQLPage } from '@backstage/plugin-graphiql';
import { SignInPage } from '@backstage/core-components';
import { auth0AuthApiRef } from './internal';
import Star from '@material-ui/icons/Star';
-import { githubAuthApiRef } from '@backstage/core-plugin-api';
+import {
+ IdentityApi,
+ githubAuthApiRef,
+ storageApiRef,
+ useApi,
+} from '@backstage/core-plugin-api';
import { SecretsContextProvider } from '@backstage/plugin-scaffolder-react';
const app = createApp({
apis,
components: {
- SignInPage: props => (
-
- ),
+ SignInPage: props => {
+ const storage = useApi(storageApiRef);
+ return (
+ {
+ props.onSignInSuccess({
+ getProfileInfo() {
+ return identityApi.getProfileInfo();
+ },
+ getBackstageIdentity() {
+ return identityApi.getBackstageIdentity();
+ },
+ getCredentials() {
+ return identityApi.getCredentials();
+ },
+ async signOut() {
+ await identityApi.signOut();
+ // happens after signout
+ storage.remove('authenticated/user');
+ },
+ });
+ // happens after successful authentication
+ const identity = await identityApi.getBackstageIdentity();
+ storage.set('authenticated/user', identity.userEntityRef);
+ }}
+ auto
+ provider={{
+ id: 'auth0-auth-provider',
+ title: 'Auth0',
+ message: 'Sign in using Auth0',
+ apiRef: auth0AuthApiRef,
+ }}
+ />
+ );
+ },
},
bindRoutes({ bind }) {
bind(catalogPlugin.externalRoutes, {
@@ -98,7 +126,10 @@ const routes = (
- } />
+ }
+ />
} />
{routes}
-
+ ,
);