Merge pull request #8035 from zfalen-deloitte/bugfix/duplicate-backstage-token
Bugfix/duplicate backstage token
This commit is contained in:
@@ -22,7 +22,7 @@ import { OAuthHandlers } from './types';
|
||||
const mockResponseData = {
|
||||
providerInfo: {
|
||||
accessToken: 'ACCESS_TOKEN',
|
||||
idToken: 'ID_TOKEN',
|
||||
token: 'ID_TOKEN',
|
||||
expiresInSeconds: 10,
|
||||
scope: 'email',
|
||||
},
|
||||
@@ -216,7 +216,7 @@ describe('OAuthAdapter', () => {
|
||||
...mockResponseData,
|
||||
backstageIdentity: {
|
||||
id: mockResponseData.backstageIdentity.id,
|
||||
idToken: 'my-id-token',
|
||||
token: 'my-id-token',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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