@okta/okta-auth-js 6.4.1 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +1 -1
  3. package/cjs/OktaAuth.js.map +1 -1
  4. package/cjs/OktaUserAgent.js +2 -2
  5. package/cjs/TransactionManager.js +25 -13
  6. package/cjs/TransactionManager.js.map +1 -1
  7. package/cjs/crypto/node.js +11 -16
  8. package/cjs/crypto/node.js.map +1 -1
  9. package/cjs/errors/AuthApiError.js.map +1 -1
  10. package/cjs/errors/AuthSdkError.js.map +1 -1
  11. package/cjs/idx/authenticate.js.map +1 -1
  12. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +1 -1
  13. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -1
  14. package/cjs/idx/authenticator/SecurityQuestionVerification.js +12 -1
  15. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -1
  16. package/cjs/idx/cancel.js.map +1 -1
  17. package/cjs/idx/flow/AuthenticationFlow.js.map +1 -1
  18. package/cjs/idx/idxState/v1/generateIdxAction.js +0 -2
  19. package/cjs/idx/idxState/v1/generateIdxAction.js.map +1 -1
  20. package/cjs/idx/idxState/v1/idxResponseParser.js +10 -5
  21. package/cjs/idx/idxState/v1/idxResponseParser.js.map +1 -1
  22. package/cjs/idx/idxState/v1/makeIdxState.js +6 -0
  23. package/cjs/idx/idxState/v1/makeIdxState.js.map +1 -1
  24. package/cjs/idx/interact.js +16 -16
  25. package/cjs/idx/interact.js.map +1 -1
  26. package/cjs/idx/introspect.js +1 -1
  27. package/cjs/idx/introspect.js.map +1 -1
  28. package/cjs/idx/proceed.js.map +1 -1
  29. package/cjs/idx/recoverPassword.js.map +1 -1
  30. package/cjs/idx/register.js.map +1 -1
  31. package/cjs/idx/remediate.js +21 -21
  32. package/cjs/idx/remediate.js.map +1 -1
  33. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +17 -8
  34. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  35. package/cjs/idx/remediators/AuthenticatorVerificationData.js +2 -1
  36. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  37. package/cjs/idx/remediators/Base/AuthenticatorData.js +4 -3
  38. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  39. package/cjs/idx/remediators/Base/Remediator.js +1 -1
  40. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  41. package/cjs/idx/remediators/Base/SelectAuthenticator.js +20 -7
  42. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  43. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +2 -2
  44. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  45. package/cjs/idx/remediators/EnrollPoll.js +2 -2
  46. package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
  47. package/cjs/idx/remediators/EnrollmentChannelData.js +2 -2
  48. package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -1
  49. package/cjs/idx/remediators/GenericRemediator/GenericRemediator.js +103 -0
  50. package/cjs/idx/remediators/GenericRemediator/GenericRemediator.js.map +1 -0
  51. package/cjs/idx/remediators/GenericRemediator/index.js +17 -0
  52. package/cjs/idx/remediators/GenericRemediator/index.js.map +1 -0
  53. package/cjs/idx/remediators/GenericRemediator/util.js +81 -0
  54. package/cjs/idx/remediators/GenericRemediator/util.js.map +1 -0
  55. package/cjs/idx/remediators/Identify.js.map +1 -1
  56. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  57. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js +1 -1
  58. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js.map +1 -1
  59. package/cjs/idx/remediators/SelectEnrollmentChannel.js +3 -2
  60. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -1
  61. package/cjs/idx/remediators/index.js +13 -0
  62. package/cjs/idx/remediators/index.js.map +1 -1
  63. package/cjs/idx/run.js +54 -16
  64. package/cjs/idx/run.js.map +1 -1
  65. package/cjs/idx/startTransaction.js.map +1 -1
  66. package/cjs/idx/transactionMeta.js +4 -2
  67. package/cjs/idx/transactionMeta.js.map +1 -1
  68. package/cjs/idx/types/api.js +42 -0
  69. package/cjs/idx/types/api.js.map +1 -0
  70. package/cjs/idx/types/idx-js.js.map +1 -1
  71. package/cjs/idx/types/index.js +27 -51
  72. package/cjs/idx/types/index.js.map +1 -1
  73. package/cjs/idx/types/options.js +2 -0
  74. package/cjs/idx/types/options.js.map +1 -0
  75. package/cjs/idx/unlockAccount.js.map +1 -1
  76. package/cjs/idx/util.js +58 -10
  77. package/cjs/idx/util.js.map +1 -1
  78. package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
  79. package/cjs/options/index.js +6 -0
  80. package/cjs/options/index.js.map +1 -1
  81. package/cjs/types/Transaction.js.map +1 -1
  82. package/dist/okta-auth-js.min.js +1 -1
  83. package/dist/okta-auth-js.min.js.map +1 -1
  84. package/dist/okta-auth-js.umd.js +1 -1
  85. package/dist/okta-auth-js.umd.js.map +1 -1
  86. package/esm/esm.browser.js +567 -301
  87. package/esm/esm.browser.js.map +1 -1
  88. package/esm/esm.node.mjs +567 -301
  89. package/esm/esm.node.mjs.map +1 -1
  90. package/lib/OktaAuth.d.ts +2 -2
  91. package/lib/TransactionManager.d.ts +4 -3
  92. package/lib/errors/AuthApiError.d.ts +2 -2
  93. package/lib/errors/AuthSdkError.d.ts +2 -2
  94. package/lib/idx/authenticate.d.ts +1 -3
  95. package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +1 -0
  96. package/lib/idx/cancel.d.ts +2 -3
  97. package/lib/idx/emailVerify.d.ts +1 -1
  98. package/lib/idx/idxState/v1/generateIdxAction.d.ts +2 -2
  99. package/lib/idx/interact.d.ts +2 -16
  100. package/lib/idx/introspect.d.ts +1 -7
  101. package/lib/idx/proceed.d.ts +1 -9
  102. package/lib/idx/recoverPassword.d.ts +1 -3
  103. package/lib/idx/register.d.ts +1 -3
  104. package/lib/idx/remediate.d.ts +3 -10
  105. package/lib/idx/remediators/AuthenticatorEnrollmentData.d.ts +1 -11
  106. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +2 -2
  107. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +5 -1
  108. package/lib/idx/remediators/Base/Remediator.d.ts +5 -4
  109. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +8 -3
  110. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +2 -1
  111. package/lib/idx/remediators/EnrollPoll.d.ts +2 -2
  112. package/lib/idx/remediators/EnrollmentChannelData.d.ts +8 -4
  113. package/lib/idx/remediators/GenericRemediator/GenericRemediator.d.ts +9 -0
  114. package/lib/idx/remediators/GenericRemediator/index.d.ts +1 -0
  115. package/lib/idx/remediators/GenericRemediator/util.d.ts +3 -0
  116. package/lib/idx/remediators/SelectAuthenticatorUnlockAccount.d.ts +1 -1
  117. package/lib/idx/remediators/SelectEnrollmentChannel.d.ts +8 -4
  118. package/lib/idx/remediators/index.d.ts +1 -0
  119. package/lib/idx/run.d.ts +1 -10
  120. package/lib/idx/startTransaction.d.ts +2 -3
  121. package/lib/idx/types/api.d.ts +104 -0
  122. package/lib/idx/types/idx-js.d.ts +16 -5
  123. package/lib/idx/types/index.d.ts +4 -110
  124. package/lib/idx/types/options.d.ts +46 -0
  125. package/lib/idx/unlockAccount.d.ts +1 -3
  126. package/lib/idx/util.d.ts +4 -3
  127. package/lib/types/OAuth.d.ts +2 -0
  128. package/lib/types/OktaAuthOptions.d.ts +28 -11
  129. package/lib/types/Storage.d.ts +2 -1
  130. package/lib/types/Transaction.d.ts +8 -28
  131. package/lib/types/api.d.ts +12 -36
  132. package/package.json +6 -5
@@ -9,6 +9,7 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
+ import { Input } from './api';
12
13
  export interface ChallengeData {
13
14
  challenge: string;
14
15
  userVerification: string;
@@ -84,7 +85,7 @@ export interface IdxForm {
84
85
  export interface IdxOption {
85
86
  value: string | {
86
87
  form: IdxForm;
87
- };
88
+ } | Input[];
88
89
  label: string;
89
90
  relatesTo?: IdxAuthenticator;
90
91
  }
@@ -123,7 +124,10 @@ export interface IdxRemediation {
123
124
  method?: string;
124
125
  type?: string;
125
126
  accepts?: string;
127
+ produces?: string;
126
128
  refresh?: number;
129
+ rel?: string[];
130
+ action?: (payload?: IdxActionParams) => Promise<IdxResponse>;
127
131
  }
128
132
  export interface IdxContext {
129
133
  version: string;
@@ -185,21 +189,28 @@ export interface RawIdxResponse {
185
189
  }
186
190
  export declare function isRawIdxResponse(obj: any): obj is RawIdxResponse;
187
191
  export interface IdxActionParams {
188
- [key: string]: string | boolean | number;
192
+ [key: string]: string | boolean | number | object;
189
193
  }
190
194
  export interface IdxActions {
191
195
  [key: string]: (params?: IdxActionParams) => Promise<IdxResponse>;
192
196
  }
197
+ export interface IdxToPersist {
198
+ interactionHandle?: string;
199
+ withCredentials?: boolean;
200
+ }
201
+ export interface IdxActionFunction {
202
+ (params: IdxActionParams): Promise<IdxResponse>;
203
+ neededParams?: Array<Array<IdxRemediationValue>>;
204
+ }
193
205
  export interface IdxResponse {
194
206
  proceed: (remediationName: string, params: unknown) => Promise<IdxResponse>;
195
207
  neededToProceed: IdxRemediation[];
196
208
  rawIdxState: RawIdxResponse;
197
209
  interactionCode?: string;
198
210
  actions: IdxActions;
199
- toPersist: {
200
- interactionHandle?: string;
201
- };
211
+ toPersist: IdxToPersist;
202
212
  context?: IdxContext;
203
213
  requestDidSucceed?: boolean;
214
+ stepUp?: boolean;
204
215
  }
205
216
  export declare function isIdxResponse(obj: any): obj is IdxResponse;
@@ -9,116 +9,10 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { InteractOptions } from '../interact';
13
- import { IntrospectOptions } from '../introspect';
14
- import { APIError, Tokens } from '../../types';
15
- import { PKCETransactionMeta } from '../../types/Transaction';
16
- import { IdxActions, IdxAuthenticator, IdxContext, IdxForm, IdxMessage, IdxOption, IdxRemediation, IdxResponse, RawIdxResponse } from './idx-js';
17
- import { FlowIdentifier } from './FlowIdentifier';
18
- export type { IdxMessage, IdxMessages, ChallengeData, ActivationData, IdxResponse, IdxContext, RawIdxResponse } from './idx-js';
19
- export type { AuthenticationOptions } from '../authenticate';
20
- export type { RegistrationOptions } from '../register';
21
- export type { PasswordRecoveryOptions } from '../recoverPassword';
22
- export type { AccountUnlockOptions } from '../unlockAccount';
23
- export type { ProceedOptions } from '../proceed';
24
- export type { CancelOptions } from '../cancel';
25
- export type { RemediateOptions } from '../remediate';
26
- export type { FlowIdentifier };
27
- export type { IdxAuthenticator };
12
+ export * from './api';
13
+ export * from './options';
14
+ export type { IdxMessage, IdxMessages, ChallengeData, ActivationData, IdxResponse, IdxContext, RawIdxResponse, IdxRemediation, IdxAuthenticator, IdxActionParams, } from './idx-js';
15
+ export type { FlowIdentifier } from './FlowIdentifier';
28
16
  export type { EmailVerifyCallbackResponse } from '../emailVerify';
29
17
  export type { WebauthnEnrollValues } from '../authenticator/WebauthnEnrollment';
30
18
  export type { WebauthnVerificationValues } from '../authenticator/WebauthnVerification';
31
- export declare enum IdxStatus {
32
- SUCCESS = "SUCCESS",
33
- PENDING = "PENDING",
34
- FAILURE = "FAILURE",
35
- TERMINAL = "TERMINAL",
36
- CANCELED = "CANCELED"
37
- }
38
- export declare enum AuthenticatorKey {
39
- OKTA_PASSWORD = "okta_password",
40
- OKTA_EMAIL = "okta_email",
41
- PHONE_NUMBER = "phone_number",
42
- GOOGLE_AUTHENTICATOR = "google_otp",
43
- SECURITY_QUESTION = "security_question",
44
- OKTA_VERIFY = "okta_verify",
45
- WEBAUTHN = "webauthn"
46
- }
47
- export declare type Input = {
48
- name: string;
49
- key?: string;
50
- type?: string;
51
- label?: string;
52
- value?: string | {
53
- form: IdxForm;
54
- };
55
- minLength?: number;
56
- maxLength?: number;
57
- secret?: boolean;
58
- required?: boolean;
59
- };
60
- export interface IdxPollOptions {
61
- required?: boolean;
62
- refresh?: number;
63
- }
64
- export declare type NextStep = {
65
- name: string;
66
- authenticator?: IdxAuthenticator;
67
- canSkip?: boolean;
68
- canResend?: boolean;
69
- inputs?: Input[];
70
- options?: IdxOption[];
71
- poll?: IdxPollOptions;
72
- authenticatorEnrollments?: IdxAuthenticator[];
73
- };
74
- export declare enum IdxFeature {
75
- PASSWORD_RECOVERY = "recover-password",
76
- REGISTRATION = "enroll-profile",
77
- SOCIAL_IDP = "redirect-idp",
78
- ACCOUNT_UNLOCK = "unlock-account"
79
- }
80
- export interface IdxTransactionMeta extends PKCETransactionMeta {
81
- interactionHandle?: string;
82
- remediations?: string[];
83
- flow?: FlowIdentifier;
84
- withCredentials?: boolean;
85
- activationToken?: string;
86
- recoveryToken?: string;
87
- }
88
- export interface IdxTransaction {
89
- status: IdxStatus;
90
- tokens?: Tokens;
91
- nextStep?: NextStep;
92
- messages?: IdxMessage[];
93
- error?: APIError | IdxResponse;
94
- meta?: IdxTransactionMeta;
95
- enabledFeatures?: IdxFeature[];
96
- availableSteps?: NextStep[];
97
- requestDidSucceed?: boolean;
98
- proceed: (remediationName: string, params: unknown) => Promise<IdxResponse>;
99
- neededToProceed: IdxRemediation[];
100
- rawIdxState: RawIdxResponse;
101
- interactionCode?: string;
102
- actions: IdxActions;
103
- context: IdxContext;
104
- }
105
- export declare type IdxOptions = InteractOptions & IntrospectOptions & {
106
- flow?: FlowIdentifier;
107
- exchangeCodeForTokens?: boolean;
108
- autoRemediate?: boolean;
109
- step?: string;
110
- };
111
- export declare type Authenticator = {
112
- id?: string;
113
- key?: string;
114
- methodType?: string;
115
- phoneNumber?: string;
116
- };
117
- export declare function isAuthenticator(obj: any): obj is Authenticator;
118
- export interface RemediationResponse {
119
- idxResponse: IdxResponse;
120
- nextStep?: NextStep;
121
- messages?: IdxMessage[];
122
- terminal?: boolean;
123
- canceled?: boolean;
124
- }
@@ -0,0 +1,46 @@
1
+ import { RemediationFlow } from '../flow';
2
+ import { RemediateAction } from '../remediate';
3
+ import { FlowIdentifier } from './FlowIdentifier';
4
+ import { AuthenticatorVerificationDataValues, EnrollProfileValues, ResetAuthenticatorValues, SelectAuthenticatorUnlockAccountValues, SkipValues, EnrollPollValues as EnrollPollOptions, SelectEnrollmentChannelValues as SelectEnrollmentChannelOptions, IdentifyValues, SelectAuthenticatorAuthenticateValues, ChallengeAuthenticatorValues, ReEnrollAuthenticatorValues, AuthenticatorEnrollmentDataValues, SelectAuthenticatorEnrollValues, EnrollAuthenticatorValues } from '../remediators';
5
+ export interface IdxOptions {
6
+ flow?: FlowIdentifier;
7
+ exchangeCodeForTokens?: boolean;
8
+ autoRemediate?: boolean;
9
+ step?: string;
10
+ withCredentials?: boolean;
11
+ }
12
+ export interface InteractOptions extends IdxOptions {
13
+ state?: string;
14
+ scopes?: string[];
15
+ codeChallenge?: string;
16
+ codeChallengeMethod?: string;
17
+ activationToken?: string;
18
+ recoveryToken?: string;
19
+ clientSecret?: string;
20
+ maxAge?: string | number;
21
+ }
22
+ export interface IntrospectOptions extends IdxOptions {
23
+ interactionHandle?: string;
24
+ stateHandle?: string;
25
+ version?: string;
26
+ }
27
+ export interface RemediateOptions extends IdxOptions {
28
+ remediators?: RemediationFlow;
29
+ actions?: RemediateAction[];
30
+ shouldProceedWithEmailAuthenticator?: boolean;
31
+ useGenericRemediator?: boolean;
32
+ }
33
+ export interface RunOptions extends RemediateOptions, InteractOptions, IntrospectOptions {
34
+ }
35
+ export interface AuthenticationOptions extends RunOptions, IdentifyValues, SelectAuthenticatorAuthenticateValues, SelectAuthenticatorEnrollValues, ChallengeAuthenticatorValues, ReEnrollAuthenticatorValues, AuthenticatorEnrollmentDataValues, EnrollAuthenticatorValues {
36
+ }
37
+ export interface RegistrationOptions extends RunOptions, IdentifyValues, EnrollProfileValues, SelectAuthenticatorEnrollValues, EnrollAuthenticatorValues, AuthenticatorEnrollmentDataValues, SkipValues {
38
+ }
39
+ export interface PasswordRecoveryOptions extends RunOptions, IdentifyValues, SelectAuthenticatorAuthenticateValues, ChallengeAuthenticatorValues, ResetAuthenticatorValues, AuthenticatorVerificationDataValues, ReEnrollAuthenticatorValues {
40
+ }
41
+ export interface AccountUnlockOptions extends RunOptions, IdentifyValues, SelectAuthenticatorUnlockAccountValues, SelectAuthenticatorAuthenticateValues, ChallengeAuthenticatorValues, AuthenticatorVerificationDataValues {
42
+ }
43
+ export interface ProceedOptions extends AuthenticationOptions, RegistrationOptions, PasswordRecoveryOptions, AccountUnlockOptions, EnrollPollOptions, SelectEnrollmentChannelOptions {
44
+ }
45
+ export declare type CancelOptions = IdxOptions;
46
+ export declare type StartOptions = RunOptions;
@@ -9,7 +9,5 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { IdentifyValues, SelectAuthenticatorUnlockAccountValues, SelectAuthenticatorAuthenticateValues, ChallengeAuthenticatorValues, AuthenticatorVerificationDataValues } from './remediators';
13
- import { OktaAuthInterface, IdxOptions, IdxTransaction } from '../types';
14
- export declare type AccountUnlockOptions = IdxOptions & IdentifyValues & SelectAuthenticatorUnlockAccountValues & SelectAuthenticatorAuthenticateValues & ChallengeAuthenticatorValues & AuthenticatorVerificationDataValues;
12
+ import { OktaAuthInterface, AccountUnlockOptions, IdxTransaction } from '../types';
15
13
  export declare function unlockAccount(authClient: OktaAuthInterface, options?: AccountUnlockOptions): Promise<IdxTransaction>;
package/lib/idx/util.d.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  import { RemediationValues, Remediator } from './remediators';
2
2
  import { IdxFeature, NextStep, RemediateOptions, RemediationResponse } from './types';
3
3
  import { IdxMessage, IdxRemediation, IdxRemediationValue, IdxResponse } from './types/idx-js';
4
+ import { OktaAuthInterface } from '../types';
4
5
  export declare function isTerminalResponse(idxResponse: IdxResponse): boolean;
5
6
  export declare function canSkipFn(idxResponse: IdxResponse): boolean;
6
7
  export declare function canResendFn(idxResponse: IdxResponse): boolean;
7
8
  export declare function getMessagesFromIdxRemediationValue(value?: IdxRemediationValue[]): IdxMessage[] | undefined;
8
9
  export declare function getMessagesFromResponse(idxResponse: IdxResponse): IdxMessage[];
9
10
  export declare function getEnabledFeatures(idxResponse: IdxResponse): IdxFeature[];
10
- export declare function getAvailableSteps(idxResponse: IdxResponse): NextStep[];
11
+ export declare function getAvailableSteps(authClient: OktaAuthInterface, idxResponse: IdxResponse, useGenericRemediator?: boolean): NextStep[];
11
12
  export declare function filterValuesForRemediation(idxResponse: IdxResponse, remediationName: string, values: RemediationValues): RemediationValues;
12
13
  export declare function getRemediator(idxRemediations: IdxRemediation[], values: RemediationValues, options: RemediateOptions): Remediator | undefined;
13
- export declare function getNextStep(remediator: Remediator, idxResponse: IdxResponse): NextStep;
14
- export declare function handleIdxError(e: any, remediator?: any): RemediationResponse;
14
+ export declare function getNextStep(authClient: OktaAuthInterface, remediator: Remediator, idxResponse: IdxResponse): NextStep;
15
+ export declare function handleIdxError(authClient: OktaAuthInterface, e: any, remediator?: any): RemediationResponse;
@@ -56,3 +56,5 @@ export interface WellKnownResponse {
56
56
  scopes_supported: string[];
57
57
  claims_supported: string[];
58
58
  }
59
+ export declare type OAuthResponseMode = 'okta_post_message' | 'fragment' | 'query' | 'form_post';
60
+ export declare type OAuthResponseType = 'code' | 'token' | 'id_token' | 'refresh_token';
@@ -14,9 +14,10 @@ import { CookieOptions } from './Cookies';
14
14
  import { HttpRequestClient } from './http';
15
15
  import { AuthState } from './AuthState';
16
16
  import { TransactionManagerOptions } from './Transaction';
17
- import { FlowIdentifier } from '../idx/types';
17
+ import { IdxTransactionMeta } from '../idx/types';
18
18
  import { ServiceManagerOptions } from './Service';
19
19
  import OktaAuth from '../OktaAuth';
20
+ import { OAuthResponseMode, OAuthResponseType } from './OAuth';
20
21
  export interface IsAuthenticatedOptions {
21
22
  onExpiredToken?: 'renew' | 'remove' | 'none';
22
23
  }
@@ -39,16 +40,36 @@ export interface CustomUrls {
39
40
  revokeUrl?: string;
40
41
  logoutUrl?: string;
41
42
  }
42
- export interface OktaAuthOptions extends CustomUrls {
43
+ export interface TokenParams extends CustomUrls {
43
44
  pkce?: boolean;
44
45
  clientId?: string;
45
46
  redirectUri?: string;
46
- useInteractionCodeFlow?: boolean;
47
- responseType?: string | string[];
48
- responseMode?: string;
49
- scopes?: string[];
47
+ responseType?: OAuthResponseType | OAuthResponseType[];
48
+ responseMode?: OAuthResponseMode;
50
49
  state?: string;
50
+ nonce?: string;
51
+ scopes?: string[];
52
+ display?: string;
51
53
  ignoreSignature?: boolean;
54
+ codeVerifier?: string;
55
+ authorizationCode?: string;
56
+ codeChallenge?: string;
57
+ codeChallengeMethod?: string;
58
+ interactionCode?: string;
59
+ idp?: string;
60
+ idpScope?: string | string[];
61
+ loginHint?: string;
62
+ maxAge?: string | number;
63
+ prompt?: string;
64
+ sessionToken?: string;
65
+ timeout?: number;
66
+ extraParams?: {
67
+ [propName: string]: string;
68
+ };
69
+ popupTitle?: string;
70
+ }
71
+ export interface OktaAuthOptions extends CustomUrls, Pick<TokenParams, 'issuer' | 'clientId' | 'redirectUri' | 'responseType' | 'responseMode' | 'scopes' | 'state' | 'pkce' | 'ignoreSignature' | 'codeChallenge' | 'codeChallengeMethod'>, Pick<IdxTransactionMeta, 'flow' | 'activationToken' | 'recoveryToken'> {
72
+ useInteractionCodeFlow?: boolean;
52
73
  ignoreLifetime?: boolean;
53
74
  tokenManager?: TokenManagerOptions;
54
75
  postLogoutRedirectUri?: string;
@@ -65,10 +86,6 @@ export interface OktaAuthOptions extends CustomUrls {
65
86
  storageManager?: StorageManagerOptions;
66
87
  services?: ServiceManagerOptions;
67
88
  transactionManager?: TransactionManagerOptions;
68
- flow?: FlowIdentifier;
69
- codeChallenge?: string;
70
- codeChallengeMethod?: string;
71
- recoveryToken?: string;
72
- activationToken?: string;
89
+ idx?: Pick<IdxTransactionMeta, 'useGenericRemediator'>;
73
90
  clientSecret?: string;
74
91
  }
@@ -12,6 +12,7 @@
12
12
  import { TransactionMeta } from './Transaction';
13
13
  import { Cookies, CookieOptions } from './Cookies';
14
14
  import { RawIdxResponse } from '../idx/types/idx-js';
15
+ import { IntrospectOptions } from '.';
15
16
  export interface TxStorage {
16
17
  get(name: string): string;
17
18
  set(name: string, value: string, expiresAt: string, options: CookieOptions): string;
@@ -40,7 +41,7 @@ export interface TransactionStorage extends StorageProvider {
40
41
  setStorage(obj: TransactionMeta): void;
41
42
  getStorage(): TransactionMeta;
42
43
  }
43
- export interface SavedIdxResponse {
44
+ export interface SavedIdxResponse extends Pick<IntrospectOptions, 'stateHandle' | 'interactionHandle'> {
44
45
  rawIdxResponse: RawIdxResponse;
45
46
  requestDidSucceed?: boolean;
46
47
  }
@@ -10,8 +10,8 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  import { StorageManager } from '../StorageManager';
13
- import { CustomUrls } from './OktaAuthOptions';
14
- import { FlowIdentifier, IdxTransactionMeta } from '../idx/types';
13
+ import { CustomUrls, TokenParams } from './OktaAuthOptions';
14
+ import { IdxTransactionMeta } from '../idx/types';
15
15
  export interface TransactionManagerOptions {
16
16
  storageManager?: StorageManager;
17
17
  enableSharedStorage?: boolean;
@@ -21,38 +21,18 @@ export interface TransactionManagerOptions {
21
21
  saveParamsCookie?: boolean;
22
22
  saveLastResponse?: boolean;
23
23
  }
24
- export interface TransactionMetaOptions {
25
- pkce?: boolean;
26
- oauth?: boolean;
27
- muteWarning?: boolean;
28
- state?: string;
29
- flow?: FlowIdentifier;
30
- codeVerifier?: string;
31
- codeChallenge?: string;
32
- codeChallengeMethod?: string;
33
- activationToken?: string;
34
- recoveryToken?: string;
35
- }
36
- export interface OAuthTransactionMeta {
37
- issuer: string;
38
- redirectUri: string;
39
- state: string;
40
- nonce: string;
41
- responseType: string | string[];
42
- responseMode?: string;
43
- scopes: string[];
44
- clientId: string;
24
+ export interface OAuthTransactionMeta extends Pick<TokenParams, 'issuer' | 'clientId' | 'redirectUri' | 'responseType' | 'responseMode' | 'scopes' | 'state' | 'pkce' | 'ignoreSignature' | 'nonce'> {
45
25
  urls: CustomUrls;
46
- ignoreSignature: boolean;
47
26
  originalUri?: string;
48
27
  }
49
- export interface PKCETransactionMeta extends OAuthTransactionMeta {
50
- codeVerifier: string;
51
- codeChallengeMethod: string;
52
- codeChallenge: string;
28
+ export interface PKCETransactionMeta extends OAuthTransactionMeta, Pick<TokenParams, 'codeChallenge' | 'codeChallengeMethod' | 'codeVerifier'> {
53
29
  }
54
30
  export declare type CustomAuthTransactionMeta = Record<string, string | undefined>;
55
31
  export declare type TransactionMeta = IdxTransactionMeta | PKCETransactionMeta | OAuthTransactionMeta | CustomAuthTransactionMeta;
32
+ export interface TransactionMetaOptions extends Pick<IdxTransactionMeta, 'pkce' | 'state' | 'codeChallenge' | 'codeChallengeMethod' | 'codeVerifier' | 'flow' | 'activationToken' | 'recoveryToken'> {
33
+ oauth?: boolean;
34
+ muteWarning?: boolean;
35
+ }
56
36
  export declare function isOAuthTransactionMeta(obj: any): obj is OAuthTransactionMeta;
57
37
  export declare function isPKCETransactionMeta(obj: any): obj is PKCETransactionMeta;
58
38
  export declare function isIdxTransactionMeta(obj: any): obj is IdxTransactionMeta;
@@ -13,16 +13,13 @@ import { AuthTransaction } from '../tx/AuthTransaction';
13
13
  import { Token, Tokens, RevocableToken, AccessToken, IDToken, RefreshToken } from './Token';
14
14
  import { JWTObject } from './JWT';
15
15
  import { UserClaims } from './UserClaims';
16
- import { CustomUrls, OktaAuthOptions } from './OktaAuthOptions';
16
+ import { CustomUrls, OktaAuthOptions, TokenParams } from './OktaAuthOptions';
17
17
  import { StorageManager } from '../StorageManager';
18
18
  import TransactionManager from '../TransactionManager';
19
19
  import { TokenManagerInterface } from './TokenManager';
20
20
  import { ServiceManagerInterface } from './Service';
21
21
  import { OktaUserAgent } from '../OktaUserAgent';
22
- import { AuthenticationOptions, RegistrationOptions as IdxRegistrationOptions, PasswordRecoveryOptions, AccountUnlockOptions, ProceedOptions, CancelOptions, IdxOptions, IdxTransaction, IdxTransactionMeta, EmailVerifyCallbackResponse, IdxAuthenticator, ChallengeData, ActivationData, WebauthnEnrollValues, WebauthnVerificationValues, FlowIdentifier, IdxPollOptions } from '../idx/types';
23
- import { InteractOptions, InteractResponse } from '../idx/interact';
24
- import { IntrospectOptions } from '../idx/introspect';
25
- import { IdxResponse } from '../idx/types/idx-js';
22
+ import { AuthenticationOptions, RegistrationOptions as IdxRegistrationOptions, PasswordRecoveryOptions, AccountUnlockOptions, ProceedOptions, CancelOptions, IdxTransaction, IdxTransactionMeta, EmailVerifyCallbackResponse, IdxAuthenticator, ChallengeData, ActivationData, WebauthnEnrollValues, WebauthnVerificationValues, FlowIdentifier, IdxPollOptions, IdxResponse, IntrospectOptions, InteractOptions, InteractResponse, StartOptions } from '../idx/types';
26
23
  import { TransactionMetaOptions } from './Transaction';
27
24
  export interface OktaAuthInterface {
28
25
  options: OktaAuthOptions;
@@ -37,12 +34,19 @@ export interface OktaAuthInterface {
37
34
  features: FeaturesAPI;
38
35
  token: TokenAPI;
39
36
  }
37
+ export interface FieldError {
38
+ errorSummary: string;
39
+ reason?: string;
40
+ location?: string;
41
+ locationType?: string;
42
+ domain?: string;
43
+ }
40
44
  export interface APIError {
41
45
  errorSummary: string;
42
46
  errorCode?: string;
43
47
  errorLink?: string;
44
48
  errorId?: string;
45
- errorCauses?: string[];
49
+ errorCauses?: Array<FieldError>;
46
50
  }
47
51
  export interface HttpAPI {
48
52
  setRequestHeader(name: string, value: string): void;
@@ -73,34 +77,6 @@ export interface SessionAPI {
73
77
  refresh: () => Promise<object>;
74
78
  setCookieAndRedirect: (sessionToken?: string, redirectUri?: string) => void;
75
79
  }
76
- export interface TokenParams extends CustomUrls {
77
- pkce?: boolean;
78
- clientId?: string;
79
- redirectUri?: string;
80
- responseType?: string | string[];
81
- responseMode?: string;
82
- state?: string;
83
- nonce?: string;
84
- scopes?: string[];
85
- display?: string;
86
- ignoreSignature?: boolean;
87
- codeVerifier?: string;
88
- authorizationCode?: string;
89
- codeChallenge?: string;
90
- codeChallengeMethod?: string;
91
- interactionCode?: string;
92
- idp?: string;
93
- idpScope?: string | string[];
94
- loginHint?: string;
95
- maxAge?: string | number;
96
- prompt?: string;
97
- sessionToken?: string;
98
- timeout?: number;
99
- extraParams?: {
100
- [propName: string]: string;
101
- };
102
- popupTitle?: string;
103
- }
104
80
  export interface PopupParams {
105
81
  popupTitle?: string;
106
82
  popupWindow?: Window;
@@ -231,13 +207,13 @@ export interface IdxAPI {
231
207
  recoverPassword: (options?: PasswordRecoveryOptions) => Promise<IdxTransaction>;
232
208
  unlockAccount: (options?: AccountUnlockOptions) => Promise<IdxTransaction>;
233
209
  poll: (options?: IdxPollOptions) => Promise<IdxTransaction>;
234
- start: (options?: IdxOptions) => Promise<IdxTransaction>;
210
+ start: (options?: StartOptions) => Promise<IdxTransaction>;
235
211
  canProceed(options?: ProceedOptions): boolean;
236
212
  proceed: (options?: ProceedOptions) => Promise<IdxTransaction>;
237
213
  cancel: (options?: CancelOptions) => Promise<IdxTransaction>;
238
214
  getFlow(): FlowIdentifier | undefined;
239
215
  setFlow(flow: FlowIdentifier): void;
240
- startTransaction: (options?: IdxOptions) => Promise<IdxTransaction>;
216
+ startTransaction: (options?: StartOptions) => Promise<IdxTransaction>;
241
217
  isInteractionRequired: (hashOrSearch?: string) => boolean;
242
218
  isInteractionRequiredError: (error: Error) => boolean;
243
219
  handleInteractionCodeRedirect: (url: string) => Promise<void>;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "name": "@okta/okta-auth-js",
4
4
  "description": "The Okta Auth SDK",
5
- "version": "6.4.1",
5
+ "version": "6.5.0",
6
6
  "homepage": "https://github.com/okta/okta-auth-js",
7
7
  "license": "Apache-2.0",
8
8
  "main": "cjs/index.js",
@@ -61,7 +61,8 @@
61
61
  "dev:samples": "yarn workspace @okta/samples dev",
62
62
  "prepare": "",
63
63
  "start": "yarn workspace @okta/test.app start --open",
64
- "stop": "kill -s TERM $(lsof -t -i:8080 -sTCP:LISTEN) || true"
64
+ "stop": "kill -s TERM $(lsof -t -i:8080 -sTCP:LISTEN) || true",
65
+ "verify:package": "node scripts/verify-package.js"
65
66
  },
66
67
  "author": "Okta",
67
68
  "keywords": [
@@ -187,8 +188,8 @@
187
188
  }
188
189
  },
189
190
  "okta": {
190
- "commitSha": "38f27304c795b6eb5e434915df7484e95e50094a",
191
- "fullVersion": "6.4.1-g38f2730",
192
- "testedSha": "d13b08bbe4f80b2009f48f2d1b1fcb4d64fc2450"
191
+ "commitSha": "73bc0e00190f7525f32c7e64eb757d18ef9f4ee1",
192
+ "fullVersion": "6.5.0-g73bc0e0",
193
+ "testedSha": "14720370492104c146b3b02dcee6bbdf463f9435"
193
194
  }
194
195
  }