hotfix for Backstage token generation, prefer .token over .idToken
Signed-off-by: Zach Falen <zfalen@deloitte.com>
This commit is contained in:
@@ -49,7 +49,9 @@ const Component: ProviderComponent = ({ config, onResult }) => {
|
||||
userId: identity!.id,
|
||||
profile: profile!,
|
||||
getIdToken: () => {
|
||||
return authApi.getBackstageIdentity().then(i => i!.idToken);
|
||||
return authApi
|
||||
.getBackstageIdentity()
|
||||
.then(i => i!.token ?? i!.idToken);
|
||||
},
|
||||
signOut: async () => {
|
||||
await authApi.signOut();
|
||||
|
||||
@@ -233,10 +233,12 @@ export class OAuthAdapter implements AuthProviderRouteHandlers {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!identity.idToken) {
|
||||
identity.idToken = await this.options.tokenIssuer.issueToken({
|
||||
if (!(identity.token || identity.idToken)) {
|
||||
identity.token = await this.options.tokenIssuer.issueToken({
|
||||
claims: { sub: identity.id },
|
||||
});
|
||||
} else if (!identity.token && identity.idToken) {
|
||||
identity.token = identity.idToken;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user