Merge pull request #6711 from backstage/rugvip/bc

core-components: fall back to using `idToken` for backwards compatibility
This commit is contained in:
Ben Lambert
2021-08-04 15:01:17 +02:00
committed by GitHub
3 changed files with 8 additions and 4 deletions
@@ -130,7 +130,9 @@ export const SingleSignInPage = ({
userId: identity!.id,
profile: profile!,
getIdToken: () => {
return authApi.getBackstageIdentity().then(i => i!.token);
return authApi
.getBackstageIdentity()
.then(i => i!.token ?? i!.idToken);
},
signOut: async () => {
await authApi.signOut();
@@ -40,7 +40,7 @@ const Component: ProviderComponent = ({ onResult }) => {
userId: identity!.id,
profile: profile!,
getIdToken: () =>
auth0AuthApi.getBackstageIdentity().then(i => i!.token),
auth0AuthApi.getBackstageIdentity().then(i => i!.token ?? i!.idToken),
signOut: async () => {
await auth0AuthApi.signOut();
},
@@ -82,7 +82,8 @@ const loader: ProviderLoader = async apis => {
return {
userId: identity.id,
profile: profile!,
getIdToken: () => auth0AuthApi.getBackstageIdentity().then(i => i!.token),
getIdToken: () =>
auth0AuthApi.getBackstageIdentity().then(i => i!.token ?? i!.idToken),
signOut: async () => {
await auth0AuthApi.signOut();
},
@@ -86,7 +86,8 @@ const loader: ProviderLoader = async (apis, apiRef) => {
return {
userId: identity.id,
profile: profile!,
getIdToken: () => authApi.getBackstageIdentity().then(i => i!.token),
getIdToken: () =>
authApi.getBackstageIdentity().then(i => i!.token ?? i!.idToken),
signOut: async () => {
await authApi.signOut();
},