diff --git a/.changeset/lucky-spiders-impress.md b/.changeset/lucky-spiders-impress.md new file mode 100644 index 0000000000..270ecf7a7c --- /dev/null +++ b/.changeset/lucky-spiders-impress.md @@ -0,0 +1,6 @@ +--- +'@backstage/core-components': patch +'@backstage/core-plugin-api': patch +--- + +Switched frontend identity code to use `token` instead of the deprecated `idToken` field diff --git a/packages/core-components/src/layout/SignInPage/SignInPage.tsx b/packages/core-components/src/layout/SignInPage/SignInPage.tsx index 1ccce80e59..d19574999f 100644 --- a/packages/core-components/src/layout/SignInPage/SignInPage.tsx +++ b/packages/core-components/src/layout/SignInPage/SignInPage.tsx @@ -130,7 +130,7 @@ export const SingleSignInPage = ({ userId: identity!.id, profile: profile!, getIdToken: () => { - return authApi.getBackstageIdentity().then(i => i!.idToken); + return authApi.getBackstageIdentity().then(i => i!.token); }, signOut: async () => { await authApi.signOut(); diff --git a/packages/core-components/src/layout/SignInPage/auth0Provider.tsx b/packages/core-components/src/layout/SignInPage/auth0Provider.tsx index f105cd4716..2f5c8b5edb 100644 --- a/packages/core-components/src/layout/SignInPage/auth0Provider.tsx +++ b/packages/core-components/src/layout/SignInPage/auth0Provider.tsx @@ -40,7 +40,7 @@ const Component: ProviderComponent = ({ onResult }) => { userId: identity!.id, profile: profile!, getIdToken: () => - auth0AuthApi.getBackstageIdentity().then(i => i!.idToken), + auth0AuthApi.getBackstageIdentity().then(i => i!.token), signOut: async () => { await auth0AuthApi.signOut(); }, @@ -82,7 +82,7 @@ const loader: ProviderLoader = async apis => { return { userId: identity.id, profile: profile!, - getIdToken: () => auth0AuthApi.getBackstageIdentity().then(i => i!.idToken), + getIdToken: () => auth0AuthApi.getBackstageIdentity().then(i => i!.token), signOut: async () => { await auth0AuthApi.signOut(); }, diff --git a/packages/core-components/src/layout/SignInPage/commonProvider.tsx b/packages/core-components/src/layout/SignInPage/commonProvider.tsx index bd46e6fa58..6f8339bcf3 100644 --- a/packages/core-components/src/layout/SignInPage/commonProvider.tsx +++ b/packages/core-components/src/layout/SignInPage/commonProvider.tsx @@ -86,7 +86,7 @@ const loader: ProviderLoader = async (apis, apiRef) => { return { userId: identity.id, profile: profile!, - getIdToken: () => authApi.getBackstageIdentity().then(i => i!.idToken), + getIdToken: () => authApi.getBackstageIdentity().then(i => i!.token), signOut: async () => { await authApi.signOut(); }, diff --git a/packages/core-plugin-api/src/apis/definitions/auth.ts b/packages/core-plugin-api/src/apis/definitions/auth.ts index c786b43fc3..9e0a3a03e3 100644 --- a/packages/core-plugin-api/src/apis/definitions/auth.ts +++ b/packages/core-plugin-api/src/apis/definitions/auth.ts @@ -151,9 +151,15 @@ export type BackstageIdentity = { id: string; /** - * An ID token that can be used to authenticate the user within Backstage. + * This is deprecated, use `token` instead. + * @deprecated */ idToken: string; + + /** + * The token used to authenticate the user within Backstage. + */ + token: string; }; /**