Skip to content

Commit 4933f55

Browse files
authored
Merge pull request #511 from ForgeRock/aj-bug-fixes
OIDC Client and Journey Client Bug Fixes
2 parents 159f743 + 036d226 commit 4933f55

4 files changed

Lines changed: 18 additions & 14 deletions

File tree

e2e/davinci-suites/src/phone-number-field.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test.describe('Device registration tests', () => {
2727
await page.goto('/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0');
2828

2929
expect(page.url()).toContain(
30-
'http://localhost:5829/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e',
30+
'http://localhost:5829/?clientId=20dd0ed0-bb9b-4c8f-9a60-9ebeb4b348e0',
3131
);
3232
await expect(page.getByText('Select Test Form')).toBeVisible();
3333

packages/journey-client/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66
*/
77

88
export * from './lib/client.store.js';
9+
10+
// Re-export types from internal packages that consumers need
11+
export { callbackType } from '@forgerock/sdk-types';

packages/journey-client/src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export type {
1313
Callback,
1414
CallbackType,
1515
StepType,
16-
callbackType,
1716
GenericError,
1817
PolicyRequirement,
1918
FailedPolicyRequirement,

packages/oidc-client/src/lib/client.store.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ export async function oidc<ActionType extends ActionTypes = ActionTypes>({
128128
},
129129

130130
/**
131-
* @function background - Initiates the authorization process in the background, returning an authorization URL or an error.
131+
* @function background - Initiates the authorization process in the background, returning code and state or an error.
132132
* @param {GetAuthorizationUrlOptions} options - Optional parameters to customize the authorization URL.
133-
* @returns {Promise<AuthorizeErrorResponse | AuthorizeSuccessResponse>} - Returns a promise that resolves to the authorization URL or an error response.
133+
* @returns {Promise<AuthorizeErrorResponse | AuthorizeSuccessResponse>} - Returns a promise that resolves to code and state or an error response.
134134
*/
135135
background: async (
136136
options?: GetAuthorizationUrlOptions,
@@ -289,16 +289,18 @@ export async function oidc<ActionType extends ActionTypes = ActionTypes>({
289289
options: storageOptions,
290290
});
291291
}),
292-
Micro.tap(async (tokens) => {
293-
await store.dispatch(
294-
oidcApi.endpoints.revoke.initiate({
295-
accessToken: tokens.accessToken,
296-
clientId: config.clientId,
297-
endpoint: wellknown.revocation_endpoint,
298-
}),
299-
);
300-
await storageClient.remove();
301-
await storageClient.set(tokens);
292+
Micro.tap(async (newTokens) => {
293+
if (tokens && 'accessToken' in tokens) {
294+
await store.dispatch(
295+
oidcApi.endpoints.revoke.initiate({
296+
accessToken: tokens.accessToken,
297+
clientId: config.clientId,
298+
endpoint: wellknown.revocation_endpoint,
299+
}),
300+
);
301+
await storageClient.remove();
302+
}
303+
await storageClient.set(newTokens);
302304
}),
303305
);
304306

0 commit comments

Comments
 (0)