Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 7.4.3

- [#1457](https://github.com/okta/okta-auth-js/pull/1457) Fix: `flow: register` now works with `useGenericRemediator: true`

## 7.4.2

### Bug Fix
Expand Down
8 changes: 7 additions & 1 deletion lib/idx/flow/FlowSpecification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@ export interface FlowSpecification {
// eslint-disable-next-line complexity
export function getFlowSpecification(
oktaAuth: OktaAuthIdxInterface,
flow: FlowIdentifier = 'default'
flow: FlowIdentifier = 'default',
useGenericRemediation = false
): FlowSpecification {
let remediators, actions, withCredentials = true;
switch (flow) {
case 'register':
case 'signup':
case 'enrollProfile':
remediators = RegistrationFlow;
if (useGenericRemediation) {
actions = [
'select-enroll-profile'
];
}
withCredentials = false;
break;
case 'recoverPassword':
Expand Down
3 changes: 2 additions & 1 deletion lib/idx/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function initializeData(authClient, data: RunData): RunData {
withCredentials,
remediators,
actions,
useGenericRemediator
} = options;

const status = IdxStatus.PENDING;
Expand All @@ -89,7 +90,7 @@ function initializeData(authClient, data: RunData): RunData {
flow = flow || authClient.idx.getFlow() || 'default';
if (flow) {
authClient.idx.setFlow(flow);
const flowSpec = getFlowSpecification(authClient, flow);
const flowSpec = getFlowSpecification(authClient, flow, useGenericRemediator);
// Favor option values over flow spec
withCredentials = (typeof withCredentials !== 'undefined') ? withCredentials : flowSpec.withCredentials;
remediators = remediators || flowSpec.remediators;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"name": "@okta/okta-auth-js",
"description": "The Okta Auth SDK",
"version": "7.4.2",
"version": "7.4.3",
"homepage": "https://github.com/okta/okta-auth-js",
"license": "Apache-2.0",
"main": "build/cjs/exports/default.js",
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/bin/bash

source ${OKTA_HOME}/${REPO}/scripts/setup.sh

Expand Down
2 changes: 1 addition & 1 deletion scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -xe
#!/bin/bash -x

source ${OKTA_HOME}/${REPO}/scripts/setup.sh

Expand Down
7 changes: 4 additions & 3 deletions test/spec/idx/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ describe('idx/run', () => {
const { authClient } = testContext;
jest.spyOn(mocked.FlowSpecification, 'getFlowSpecification');
await run(authClient, { flow: 'signup' });
expect(mocked.FlowSpecification.getFlowSpecification).toHaveBeenCalledWith(authClient, 'signup');
expect(mocked.FlowSpecification.getFlowSpecification).toHaveBeenCalledWith(authClient, 'signup', undefined);
});
});

Expand Down Expand Up @@ -232,8 +232,9 @@ describe('idx/run', () => {
password,
stateHandle: idxResponse.rawIdxState.stateHandle
};
const flowSpec = mocked.FlowSpecification.getFlowSpecification(authClient, flow);
const flowSpec = mocked.FlowSpecification.getFlowSpecification(authClient, flow, options.useGenericRemediator);
const { remediators, actions, flowMonitor } = flowSpec;
expect(actions).toEqual(['select-enroll-profile']); // GenericRemediator now returns register as action
await run(authClient, options);
expect(mocked.remediate.remediate).toHaveBeenCalledWith(authClient, idxResponse, values, {
remediators,
Expand Down Expand Up @@ -267,7 +268,7 @@ describe('idx/run', () => {
password,
stateHandle: idxResponse.rawIdxState.stateHandle
};
const flowSpec = mocked.FlowSpecification.getFlowSpecification(authClient, flow);
const flowSpec = mocked.FlowSpecification.getFlowSpecification(authClient, flow, true);
const { remediators, actions, flowMonitor } = flowSpec;
await run(authClient, options);
expect(mocked.remediate.remediate).toHaveBeenCalledWith(authClient, idxResponse, values, {
Expand Down