Merge pull request #6675 from backstage/fix-idtoken

Switch frontend identity to use `token` instead of `idToken`
This commit is contained in:
Ben Lambert
2021-08-03 16:46:06 +02:00
committed by GitHub
6 changed files with 17 additions and 5 deletions
+6
View File
@@ -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
@@ -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();
@@ -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();
},
@@ -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();
},
+1
View File
@@ -196,6 +196,7 @@ export type AuthRequestOptions = {
export type BackstageIdentity = {
id: string;
idToken: string;
token: string;
};
// Warning: (tsdoc-undefined-tag) The TSDoc tag "@IdentityApi" is not defined in this configuration
@@ -151,9 +151,14 @@ export type BackstageIdentity = {
id: string;
/**
* An ID token that can be used to authenticate the user within Backstage.
* @deprecated This is deprecated, use `token` instead.
*/
idToken: string;
/**
* The token used to authenticate the user within Backstage.
*/
token: string;
};
/**