@okta/okta-auth-js 6.4.2 → 6.4.5

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 (86) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/cjs/OktaAuth.js.map +1 -1
  3. package/cjs/OktaUserAgent.js +2 -2
  4. package/cjs/TransactionManager.js +25 -13
  5. package/cjs/TransactionManager.js.map +1 -1
  6. package/cjs/errors/AuthApiError.js.map +1 -1
  7. package/cjs/errors/AuthSdkError.js.map +1 -1
  8. package/cjs/idx/authenticate.js.map +1 -1
  9. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +1 -1
  10. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -1
  11. package/cjs/idx/authenticator/SecurityQuestionVerification.js +12 -1
  12. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -1
  13. package/cjs/idx/authenticator/WebauthnEnrollment.js +8 -3
  14. package/cjs/idx/authenticator/WebauthnEnrollment.js.map +1 -1
  15. package/cjs/idx/authenticator/WebauthnVerification.js +8 -3
  16. package/cjs/idx/authenticator/WebauthnVerification.js.map +1 -1
  17. package/cjs/idx/cancel.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/interact.js.map +1 -1
  21. package/cjs/idx/introspect.js +1 -1
  22. package/cjs/idx/introspect.js.map +1 -1
  23. package/cjs/idx/proceed.js.map +1 -1
  24. package/cjs/idx/recoverPassword.js.map +1 -1
  25. package/cjs/idx/register.js.map +1 -1
  26. package/cjs/idx/remediate.js +12 -12
  27. package/cjs/idx/remediate.js.map +1 -1
  28. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  29. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  30. package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -1
  31. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -1
  32. package/cjs/idx/run.js +39 -6
  33. package/cjs/idx/run.js.map +1 -1
  34. package/cjs/idx/startTransaction.js.map +1 -1
  35. package/cjs/idx/types/api.js +42 -0
  36. package/cjs/idx/types/api.js.map +1 -0
  37. package/cjs/idx/types/idx-js.js.map +1 -1
  38. package/cjs/idx/types/index.js +27 -51
  39. package/cjs/idx/types/index.js.map +1 -1
  40. package/cjs/idx/types/options.js +2 -0
  41. package/cjs/idx/types/options.js.map +1 -0
  42. package/cjs/idx/unlockAccount.js.map +1 -1
  43. package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
  44. package/cjs/types/Transaction.js.map +1 -1
  45. package/dist/okta-auth-js.min.js +1 -1
  46. package/dist/okta-auth-js.min.js.map +1 -1
  47. package/dist/okta-auth-js.umd.js +1 -1
  48. package/dist/okta-auth-js.umd.js.map +1 -1
  49. package/esm/esm.browser.js +114 -77
  50. package/esm/esm.browser.js.map +1 -1
  51. package/esm/esm.node.mjs +114 -77
  52. package/esm/esm.node.mjs.map +1 -1
  53. package/lib/OktaAuth.d.ts +2 -2
  54. package/lib/TransactionManager.d.ts +4 -3
  55. package/lib/errors/AuthApiError.d.ts +2 -2
  56. package/lib/errors/AuthSdkError.d.ts +2 -2
  57. package/lib/idx/authenticate.d.ts +1 -3
  58. package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +1 -0
  59. package/lib/idx/authenticator/WebauthnEnrollment.d.ts +1 -0
  60. package/lib/idx/authenticator/WebauthnVerification.d.ts +1 -0
  61. package/lib/idx/cancel.d.ts +2 -3
  62. package/lib/idx/emailVerify.d.ts +1 -1
  63. package/lib/idx/idxState/v1/generateIdxAction.d.ts +2 -2
  64. package/lib/idx/interact.d.ts +1 -16
  65. package/lib/idx/introspect.d.ts +1 -7
  66. package/lib/idx/proceed.d.ts +1 -9
  67. package/lib/idx/recoverPassword.d.ts +1 -3
  68. package/lib/idx/register.d.ts +1 -3
  69. package/lib/idx/remediate.d.ts +1 -9
  70. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +1 -2
  71. package/lib/idx/remediators/Base/Remediator.d.ts +2 -2
  72. package/lib/idx/remediators/EnrollmentChannelData.d.ts +3 -3
  73. package/lib/idx/remediators/SelectEnrollmentChannel.d.ts +3 -3
  74. package/lib/idx/run.d.ts +1 -10
  75. package/lib/idx/startTransaction.d.ts +2 -3
  76. package/lib/idx/types/api.d.ts +99 -0
  77. package/lib/idx/types/idx-js.d.ts +10 -3
  78. package/lib/idx/types/index.d.ts +4 -110
  79. package/lib/idx/types/options.d.ts +44 -0
  80. package/lib/idx/unlockAccount.d.ts +1 -3
  81. package/lib/types/OAuth.d.ts +2 -0
  82. package/lib/types/OktaAuthOptions.d.ts +27 -11
  83. package/lib/types/Storage.d.ts +2 -1
  84. package/lib/types/Transaction.d.ts +8 -28
  85. package/lib/types/api.d.ts +12 -36
  86. package/package.json +4 -4
@@ -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,5 @@ 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;
73
89
  clientSecret?: string;
74
90
  }
@@ -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.2",
5
+ "version": "6.4.5",
6
6
  "homepage": "https://github.com/okta/okta-auth-js",
7
7
  "license": "Apache-2.0",
8
8
  "main": "cjs/index.js",
@@ -187,8 +187,8 @@
187
187
  }
188
188
  },
189
189
  "okta": {
190
- "commitSha": "df5296fe5935b093118455de1856279ea0aa4790",
191
- "fullVersion": "6.4.2-gdf5296f",
192
- "testedSha": "8b2980f93ad144dc81ba8c9866ed380a86396544"
190
+ "commitSha": "445b4fb3e8e5da1ce20a9c2aa568c53ecf0d5821",
191
+ "fullVersion": "6.4.5-g445b4fb",
192
+ "testedSha": "77c77566ab6998f2235829a206ffef90a9c09d74"
193
193
  }
194
194
  }