Switch frontend identity to token instead of idToken

Co-authored-by: Joe Porpeglia <josephp@spotify.com>
Signed-off-by: Tim Hansen <timbonicus@gmail.com>
This commit is contained in:
Tim Hansen
2021-07-29 15:43:09 -06:00
parent c49b012d55
commit c4d8ff9638
5 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();
},
@@ -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;
};
/**