@aws-amplify/auth 4.3.20-custom-pk.97 → 4.3.20-custom-pk.156
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.
- package/CHANGELOG.md +38 -85
- package/dist/aws-amplify-auth.js +181 -10
- package/dist/aws-amplify-auth.js.map +1 -1
- package/dist/aws-amplify-auth.min.js +8 -8
- package/dist/aws-amplify-auth.min.js.map +1 -1
- package/lib/Auth.d.ts +6 -0
- package/lib/Auth.js +125 -10
- package/lib/Auth.js.map +1 -1
- package/lib/Errors.js +3 -0
- package/lib/Errors.js.map +1 -1
- package/lib/common/AuthErrorStrings.d.ts +2 -1
- package/lib/common/AuthErrorStrings.js +1 -0
- package/lib/common/AuthErrorStrings.js.map +1 -1
- package/lib/types/Auth.d.ts +11 -1
- package/lib/types/Auth.js +1 -0
- package/lib/types/Auth.js.map +1 -1
- package/lib-esm/Auth.d.ts +6 -0
- package/lib-esm/Auth.js +125 -10
- package/lib-esm/Auth.js.map +1 -1
- package/lib-esm/Errors.js +3 -0
- package/lib-esm/Errors.js.map +1 -1
- package/lib-esm/common/AuthErrorStrings.d.ts +2 -1
- package/lib-esm/common/AuthErrorStrings.js +1 -0
- package/lib-esm/common/AuthErrorStrings.js.map +1 -1
- package/lib-esm/types/Auth.d.ts +11 -1
- package/lib-esm/types/Auth.js +1 -0
- package/lib-esm/types/Auth.js.map +1 -1
- package/package.json +5 -5
- package/src/Auth.ts +153 -1
- package/src/Errors.ts +3 -0
- package/src/common/AuthErrorStrings.ts +1 -0
- package/src/types/Auth.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [4.
|
|
6
|
+
## [4.6.8](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.6...@aws-amplify/auth@4.6.8) (2022-09-30)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
9
9
|
|
|
@@ -11,19 +11,15 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
## [4.
|
|
15
|
-
|
|
14
|
+
## [4.6.7](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.6...@aws-amplify/auth@4.6.7) (2022-09-20)
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* **amazon-cognito-identity-js:** Missing cognito user challenge name … ([#10047](https://github.com/aws-amplify/amplify-js/issues/10047)) ([de0441b](https://github.com/aws-amplify/amplify-js/commit/de0441b4fa67409ccbc630c42890e2c58ee779fb)), closes [#6974](https://github.com/aws-amplify/amplify-js/issues/6974)
|
|
20
|
-
* Update Auth to import JS using named export ([#10033](https://github.com/aws-amplify/amplify-js/issues/10033)) ([11b537c](https://github.com/aws-amplify/amplify-js/commit/11b537c62fee74c04e4e3b72ba43a353ba5152c9))
|
|
16
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
21
17
|
|
|
22
18
|
|
|
23
19
|
|
|
24
20
|
|
|
25
21
|
|
|
26
|
-
## [4.
|
|
22
|
+
## [4.6.6](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.5...@aws-amplify/auth@4.6.6) (2022-09-08)
|
|
27
23
|
|
|
28
24
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
29
25
|
|
|
@@ -31,7 +27,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
31
27
|
|
|
32
28
|
|
|
33
29
|
|
|
34
|
-
## [4.5
|
|
30
|
+
## [4.6.5](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.4...@aws-amplify/auth@4.6.5) (2022-09-01)
|
|
35
31
|
|
|
36
32
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
37
33
|
|
|
@@ -39,183 +35,140 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
39
35
|
|
|
40
36
|
|
|
41
37
|
|
|
42
|
-
## [4.
|
|
38
|
+
## [4.6.4](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.3...@aws-amplify/auth@4.6.4) (2022-08-23)
|
|
43
39
|
|
|
44
40
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
45
41
|
|
|
42
|
+
## [4.6.3](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.2...@aws-amplify/auth@4.6.3) (2022-08-18)
|
|
46
43
|
|
|
44
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
47
45
|
|
|
46
|
+
## [4.6.2](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.1...@aws-amplify/auth@4.6.2) (2022-08-16)
|
|
48
47
|
|
|
48
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
49
49
|
|
|
50
|
-
## [4.
|
|
50
|
+
## [4.6.1](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.6.0...@aws-amplify/auth@4.6.1) (2022-08-01)
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
### Bug Fixes
|
|
53
53
|
|
|
54
|
+
- **@aws-amplify/auth:** fix storage bug for auto sign in value ([#10139](https://github.com/aws-amplify/amplify-js/issues/10139)) ([06504e6](https://github.com/aws-amplify/amplify-js/commit/06504e649068f01b85392373fdf80e2ed2a6cada))
|
|
55
|
+
- **auth:** Unauthenticated identity throws AuthError without user … ([#10090](https://github.com/aws-amplify/amplify-js/issues/10090)) ([2ac9035](https://github.com/aws-amplify/amplify-js/commit/2ac903516ec295fbf098f6a6644000177f315184))
|
|
54
56
|
|
|
57
|
+
# [4.6.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.10...@aws-amplify/auth@4.6.0) (2022-07-28)
|
|
55
58
|
|
|
59
|
+
### Features
|
|
56
60
|
|
|
61
|
+
- **@aws-amplify/auth:** Auto sign in after sign up ([#10126](https://github.com/aws-amplify/amplify-js/issues/10126)) ([e54617f](https://github.com/aws-amplify/amplify-js/commit/e54617f2878244f0e391d2d49f5cd2e8a8c069f9)), closes [#6320](https://github.com/aws-amplify/amplify-js/issues/6320) [#3882](https://github.com/aws-amplify/amplify-js/issues/3882) [#3631](https://github.com/aws-amplify/amplify-js/issues/3631) [#6018](https://github.com/aws-amplify/amplify-js/issues/6018)
|
|
57
62
|
|
|
58
|
-
## [4.5.
|
|
63
|
+
## [4.5.10](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.9...@aws-amplify/auth@4.5.10) (2022-07-21)
|
|
59
64
|
|
|
60
65
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
61
66
|
|
|
67
|
+
## [4.5.9](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.8...@aws-amplify/auth@4.5.9) (2022-07-07)
|
|
62
68
|
|
|
69
|
+
### Bug Fixes
|
|
63
70
|
|
|
71
|
+
- **amazon-cognito-identity-js:** Missing cognito user challenge name … ([#10047](https://github.com/aws-amplify/amplify-js/issues/10047)) ([de0441b](https://github.com/aws-amplify/amplify-js/commit/de0441b4fa67409ccbc630c42890e2c58ee779fb)), closes [#6974](https://github.com/aws-amplify/amplify-js/issues/6974)
|
|
72
|
+
- Update Auth to import JS using named export ([#10033](https://github.com/aws-amplify/amplify-js/issues/10033)) ([11b537c](https://github.com/aws-amplify/amplify-js/commit/11b537c62fee74c04e4e3b72ba43a353ba5152c9))
|
|
64
73
|
|
|
65
|
-
|
|
66
|
-
## [4.5.3](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.2...@aws-amplify/auth@4.5.3) (2022-05-03)
|
|
74
|
+
## [4.5.8](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.7...@aws-amplify/auth@4.5.8) (2022-06-18)
|
|
67
75
|
|
|
68
76
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
69
77
|
|
|
78
|
+
## [4.5.7](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.6...@aws-amplify/auth@4.5.7) (2022-06-15)
|
|
70
79
|
|
|
80
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
71
81
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
## [4.5.2](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.1...@aws-amplify/auth@4.5.2) (2022-04-14)
|
|
82
|
+
## [4.5.6](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.5...@aws-amplify/auth@4.5.6) (2022-05-24)
|
|
75
83
|
|
|
76
84
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
77
85
|
|
|
86
|
+
## [4.5.5](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.4...@aws-amplify/auth@4.5.5) (2022-05-23)
|
|
78
87
|
|
|
88
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
79
89
|
|
|
90
|
+
## [4.5.4](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.3...@aws-amplify/auth@4.5.4) (2022-05-12)
|
|
80
91
|
|
|
92
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
81
93
|
|
|
82
|
-
## [4.5.
|
|
94
|
+
## [4.5.3](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.2...@aws-amplify/auth@4.5.3) (2022-05-03)
|
|
83
95
|
|
|
84
96
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
85
97
|
|
|
98
|
+
## [4.5.2](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.1...@aws-amplify/auth@4.5.2) (2022-04-14)
|
|
86
99
|
|
|
100
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
87
101
|
|
|
102
|
+
## [4.5.1](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.5.0...@aws-amplify/auth@4.5.1) (2022-04-04)
|
|
88
103
|
|
|
104
|
+
**Note:** Version bump only for package @aws-amplify/auth
|
|
89
105
|
|
|
90
106
|
# [4.5.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.4.4...@aws-amplify/auth@4.5.0) (2022-03-28)
|
|
91
107
|
|
|
92
|
-
|
|
93
108
|
### Features
|
|
94
109
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
110
|
+
- PubSub Add Options objects for all Providers and fix: Spelling error and deprecation of old exports ([#9683](https://github.com/aws-amplify/amplify-js/issues/9683)) ([b535af2](https://github.com/aws-amplify/amplify-js/commit/b535af2133b5460c6e8e2fcfd89e1fe235872c27))
|
|
100
111
|
|
|
101
112
|
## [4.4.4](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.4.3...@aws-amplify/auth@4.4.4) (2022-03-22)
|
|
102
113
|
|
|
103
114
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
104
115
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
116
|
## [4.4.3](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.4.2...@aws-amplify/auth@4.4.3) (2022-03-10)
|
|
110
117
|
|
|
111
|
-
|
|
112
118
|
### Bug Fixes
|
|
113
119
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
- **@aws-amplify/auth:** Invalid session cleanup ([#9628](https://github.com/aws-amplify/amplify-js/issues/9628)) ([7459d54](https://github.com/aws-amplify/amplify-js/commit/7459d54ccb21576c1c5a4b45b4b72183364b681b))
|
|
119
121
|
|
|
120
122
|
## [4.4.2](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.4.1...@aws-amplify/auth@4.4.2) (2022-02-28)
|
|
121
123
|
|
|
122
124
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
123
125
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
126
|
## [4.4.1](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.4.0...@aws-amplify/auth@4.4.1) (2022-02-03)
|
|
129
127
|
|
|
130
128
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
131
129
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
130
|
# [4.4.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.20...@aws-amplify/auth@4.4.0) (2022-01-27)
|
|
137
131
|
|
|
138
|
-
|
|
139
132
|
### Features
|
|
140
133
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
134
|
+
- **@aws-amplify/auth:** Delete user API exposed ([#9428](https://github.com/aws-amplify/amplify-js/issues/9428)) ([bf3d189](https://github.com/aws-amplify/amplify-js/commit/bf3d189c9e7e14342230fca8a0cbba6972e7b42c))
|
|
146
135
|
|
|
147
136
|
## [4.3.20](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.19...@aws-amplify/auth@4.3.20) (2022-01-07)
|
|
148
137
|
|
|
149
138
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
150
139
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
140
|
## [4.3.19](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.18...@aws-amplify/auth@4.3.19) (2021-12-16)
|
|
156
141
|
|
|
157
142
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
158
143
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
144
|
## [4.3.18](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.17...@aws-amplify/auth@4.3.18) (2021-12-03)
|
|
164
145
|
|
|
165
146
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
166
147
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
148
|
## [4.3.17](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.16...@aws-amplify/auth@4.3.17) (2021-12-02)
|
|
172
149
|
|
|
173
150
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
174
151
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
152
|
## [4.3.16](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.15...@aws-amplify/auth@4.3.16) (2021-11-18)
|
|
180
153
|
|
|
181
154
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
182
155
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
156
|
## [4.3.15](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.14...@aws-amplify/auth@4.3.15) (2021-11-16)
|
|
188
157
|
|
|
189
158
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
190
159
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
160
|
## [4.3.14](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.13...@aws-amplify/auth@4.3.14) (2021-11-12)
|
|
196
161
|
|
|
197
162
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
198
163
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
164
|
## [4.3.13](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.12...@aws-amplify/auth@4.3.13) (2021-11-09)
|
|
204
165
|
|
|
205
166
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
206
167
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
168
|
## [4.3.12](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.11...@aws-amplify/auth@4.3.12) (2021-10-28)
|
|
212
169
|
|
|
213
170
|
**Note:** Version bump only for package @aws-amplify/auth
|
|
214
171
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
172
|
## [4.3.11](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/auth@4.3.10...@aws-amplify/auth@4.3.11) (2021-10-21)
|
|
220
173
|
|
|
221
174
|
### Bug Fixes
|
package/dist/aws-amplify-auth.js
CHANGED
|
@@ -10710,6 +10710,7 @@ var dispatchAuthEvent = function dispatchAuthEvent(event, data, message) {
|
|
|
10710
10710
|
|
|
10711
10711
|
|
|
10712
10712
|
var MAX_DEVICES = 60;
|
|
10713
|
+
var MAX_AUTOSIGNIN_POLLING_MS = 3 * 60 * 1000;
|
|
10713
10714
|
/**
|
|
10714
10715
|
* Provide authentication steps
|
|
10715
10716
|
*/
|
|
@@ -10727,6 +10728,7 @@ function () {
|
|
|
10727
10728
|
this.userPool = null;
|
|
10728
10729
|
this.user = null;
|
|
10729
10730
|
this.oAuthFlowInProgress = false;
|
|
10731
|
+
this.autoSignInInitiated = false;
|
|
10730
10732
|
this.Credentials = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Credentials"];
|
|
10731
10733
|
|
|
10732
10734
|
this.wrapRefreshSessionCallback = function (callback) {
|
|
@@ -10872,6 +10874,19 @@ function () {
|
|
|
10872
10874
|
}
|
|
10873
10875
|
|
|
10874
10876
|
dispatchAuthEvent('configured', null, "The Auth category has been configured successfully");
|
|
10877
|
+
|
|
10878
|
+
if (!this.autoSignInInitiated && typeof this._storage['getItem'] === 'function') {
|
|
10879
|
+
var pollingInitiated = this.isTrueStorageValue('amplify-polling-started');
|
|
10880
|
+
|
|
10881
|
+
if (pollingInitiated) {
|
|
10882
|
+
dispatchAuthEvent('autoSignIn_failure', null, _types_Auth__WEBPACK_IMPORTED_MODULE_7__["AuthErrorTypes"].AutoSignInError);
|
|
10883
|
+
|
|
10884
|
+
this._storage.removeItem('amplify-auto-sign-in');
|
|
10885
|
+
}
|
|
10886
|
+
|
|
10887
|
+
this._storage.removeItem('amplify-polling-started');
|
|
10888
|
+
}
|
|
10889
|
+
|
|
10875
10890
|
return this._config;
|
|
10876
10891
|
};
|
|
10877
10892
|
/**
|
|
@@ -10891,6 +10906,8 @@ function () {
|
|
|
10891
10906
|
restOfAttrs[_i - 1] = arguments[_i];
|
|
10892
10907
|
}
|
|
10893
10908
|
|
|
10909
|
+
var _a, _b, _c;
|
|
10910
|
+
|
|
10894
10911
|
if (!this.userPool) {
|
|
10895
10912
|
return this.rejectNoUserPool();
|
|
10896
10913
|
}
|
|
@@ -10900,6 +10917,11 @@ function () {
|
|
|
10900
10917
|
var attributes = [];
|
|
10901
10918
|
var validationData = null;
|
|
10902
10919
|
var clientMetadata;
|
|
10920
|
+
var autoSignIn = {
|
|
10921
|
+
enabled: false
|
|
10922
|
+
};
|
|
10923
|
+
var autoSignInValidationData = {};
|
|
10924
|
+
var autoSignInClientMetaData = {};
|
|
10903
10925
|
|
|
10904
10926
|
if (params && typeof params === 'string') {
|
|
10905
10927
|
username = params;
|
|
@@ -10946,6 +10968,17 @@ function () {
|
|
|
10946
10968
|
}));
|
|
10947
10969
|
});
|
|
10948
10970
|
}
|
|
10971
|
+
|
|
10972
|
+
autoSignIn = (_a = params.autoSignIn) !== null && _a !== void 0 ? _a : {
|
|
10973
|
+
enabled: false
|
|
10974
|
+
};
|
|
10975
|
+
|
|
10976
|
+
if (autoSignIn.enabled) {
|
|
10977
|
+
this._storage.setItem('amplify-auto-sign-in', 'true');
|
|
10978
|
+
|
|
10979
|
+
autoSignInValidationData = (_b = autoSignIn.validationData) !== null && _b !== void 0 ? _b : {};
|
|
10980
|
+
autoSignInClientMetaData = (_c = autoSignIn.clientMetaData) !== null && _c !== void 0 ? _c : {};
|
|
10981
|
+
}
|
|
10949
10982
|
} else {
|
|
10950
10983
|
return this.rejectAuthError(_types_Auth__WEBPACK_IMPORTED_MODULE_7__["AuthErrorTypes"].SignUpError);
|
|
10951
10984
|
}
|
|
@@ -10967,11 +11000,126 @@ function () {
|
|
|
10967
11000
|
reject(err);
|
|
10968
11001
|
} else {
|
|
10969
11002
|
dispatchAuthEvent('signUp', data, username + " has signed up successfully");
|
|
11003
|
+
|
|
11004
|
+
if (autoSignIn.enabled) {
|
|
11005
|
+
_this.handleAutoSignIn(username, password, autoSignInValidationData, autoSignInClientMetaData, data);
|
|
11006
|
+
}
|
|
11007
|
+
|
|
10970
11008
|
resolve(data);
|
|
10971
11009
|
}
|
|
10972
11010
|
}, clientMetadata);
|
|
10973
11011
|
});
|
|
10974
11012
|
};
|
|
11013
|
+
|
|
11014
|
+
AuthClass.prototype.handleAutoSignIn = function (username, password, validationData, clientMetadata, data) {
|
|
11015
|
+
this.autoSignInInitiated = true;
|
|
11016
|
+
var authDetails = new amazon_cognito_identity_js__WEBPACK_IMPORTED_MODULE_2__["AuthenticationDetails"]({
|
|
11017
|
+
Username: username,
|
|
11018
|
+
Password: password,
|
|
11019
|
+
ValidationData: validationData,
|
|
11020
|
+
ClientMetadata: clientMetadata
|
|
11021
|
+
});
|
|
11022
|
+
|
|
11023
|
+
if (data.userConfirmed) {
|
|
11024
|
+
this.signInAfterUserConfirmed(authDetails);
|
|
11025
|
+
} else if (this._config.signUpVerificationMethod === 'link') {
|
|
11026
|
+
this.handleLinkAutoSignIn(authDetails);
|
|
11027
|
+
} else {
|
|
11028
|
+
this.handleCodeAutoSignIn(authDetails);
|
|
11029
|
+
}
|
|
11030
|
+
};
|
|
11031
|
+
|
|
11032
|
+
AuthClass.prototype.handleCodeAutoSignIn = function (authDetails) {
|
|
11033
|
+
var _this = this;
|
|
11034
|
+
|
|
11035
|
+
var listenEvent = function listenEvent(_a) {
|
|
11036
|
+
var payload = _a.payload;
|
|
11037
|
+
|
|
11038
|
+
if (payload.event === 'confirmSignUp') {
|
|
11039
|
+
_this.signInAfterUserConfirmed(authDetails, listenEvent);
|
|
11040
|
+
}
|
|
11041
|
+
};
|
|
11042
|
+
|
|
11043
|
+
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Hub"].listen('auth', listenEvent);
|
|
11044
|
+
};
|
|
11045
|
+
|
|
11046
|
+
AuthClass.prototype.handleLinkAutoSignIn = function (authDetails) {
|
|
11047
|
+
var _this = this;
|
|
11048
|
+
|
|
11049
|
+
this._storage.setItem('amplify-polling-started', 'true');
|
|
11050
|
+
|
|
11051
|
+
var start = Date.now();
|
|
11052
|
+
var autoSignInPollingIntervalId = setInterval(function () {
|
|
11053
|
+
if (Date.now() - start > MAX_AUTOSIGNIN_POLLING_MS) {
|
|
11054
|
+
clearInterval(autoSignInPollingIntervalId);
|
|
11055
|
+
dispatchAuthEvent('autoSignIn_failure', null, 'Please confirm your account and use your credentials to sign in.');
|
|
11056
|
+
|
|
11057
|
+
_this._storage.removeItem('amplify-auto-sign-in');
|
|
11058
|
+
} else {
|
|
11059
|
+
_this.signInAfterUserConfirmed(authDetails, null, autoSignInPollingIntervalId);
|
|
11060
|
+
}
|
|
11061
|
+
}, 5000);
|
|
11062
|
+
};
|
|
11063
|
+
|
|
11064
|
+
AuthClass.prototype.signInAfterUserConfirmed = function (authDetails, listenEvent, autoSignInPollingIntervalId) {
|
|
11065
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11066
|
+
var user, error_1;
|
|
11067
|
+
|
|
11068
|
+
var _this = this;
|
|
11069
|
+
|
|
11070
|
+
return __generator(this, function (_a) {
|
|
11071
|
+
switch (_a.label) {
|
|
11072
|
+
case 0:
|
|
11073
|
+
user = this.createCognitoUser(authDetails.getUsername());
|
|
11074
|
+
_a.label = 1;
|
|
11075
|
+
|
|
11076
|
+
case 1:
|
|
11077
|
+
_a.trys.push([1, 3,, 4]);
|
|
11078
|
+
|
|
11079
|
+
return [4
|
|
11080
|
+
/*yield*/
|
|
11081
|
+
, user.authenticateUser(authDetails, this.authCallbacks(user, function (value) {
|
|
11082
|
+
dispatchAuthEvent('autoSignIn', value, authDetails.getUsername() + " has signed in successfully");
|
|
11083
|
+
|
|
11084
|
+
if (listenEvent) {
|
|
11085
|
+
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Hub"].remove('auth', listenEvent);
|
|
11086
|
+
}
|
|
11087
|
+
|
|
11088
|
+
if (autoSignInPollingIntervalId) {
|
|
11089
|
+
clearInterval(autoSignInPollingIntervalId);
|
|
11090
|
+
|
|
11091
|
+
_this._storage.removeItem('amplify-polling-started');
|
|
11092
|
+
}
|
|
11093
|
+
|
|
11094
|
+
_this._storage.removeItem('amplify-auto-sign-in');
|
|
11095
|
+
}, function (error) {
|
|
11096
|
+
logger.error(error);
|
|
11097
|
+
|
|
11098
|
+
_this._storage.removeItem('amplify-auto-sign-in');
|
|
11099
|
+
}))];
|
|
11100
|
+
|
|
11101
|
+
case 2:
|
|
11102
|
+
_a.sent();
|
|
11103
|
+
|
|
11104
|
+
return [3
|
|
11105
|
+
/*break*/
|
|
11106
|
+
, 4];
|
|
11107
|
+
|
|
11108
|
+
case 3:
|
|
11109
|
+
error_1 = _a.sent();
|
|
11110
|
+
logger.error(error_1);
|
|
11111
|
+
return [3
|
|
11112
|
+
/*break*/
|
|
11113
|
+
, 4];
|
|
11114
|
+
|
|
11115
|
+
case 4:
|
|
11116
|
+
return [2
|
|
11117
|
+
/*return*/
|
|
11118
|
+
];
|
|
11119
|
+
}
|
|
11120
|
+
});
|
|
11121
|
+
});
|
|
11122
|
+
};
|
|
10975
11123
|
/**
|
|
10976
11124
|
* Send the verification code to confirm sign up
|
|
10977
11125
|
* @param {String} username - The username to be confirmed
|
|
@@ -10982,6 +11130,8 @@ function () {
|
|
|
10982
11130
|
|
|
10983
11131
|
|
|
10984
11132
|
AuthClass.prototype.confirmSignUp = function (username, code, options) {
|
|
11133
|
+
var _this = this;
|
|
11134
|
+
|
|
10985
11135
|
if (!this.userPool) {
|
|
10986
11136
|
return this.rejectNoUserPool();
|
|
10987
11137
|
}
|
|
@@ -11009,11 +11159,27 @@ function () {
|
|
|
11009
11159
|
if (err) {
|
|
11010
11160
|
reject(err);
|
|
11011
11161
|
} else {
|
|
11162
|
+
dispatchAuthEvent('confirmSignUp', data, username + " has been confirmed successfully");
|
|
11163
|
+
|
|
11164
|
+
var autoSignIn = _this.isTrueStorageValue('amplify-auto-sign-in');
|
|
11165
|
+
|
|
11166
|
+
if (autoSignIn && !_this.autoSignInInitiated) {
|
|
11167
|
+
dispatchAuthEvent('autoSignIn_failure', null, _types_Auth__WEBPACK_IMPORTED_MODULE_7__["AuthErrorTypes"].AutoSignInError);
|
|
11168
|
+
|
|
11169
|
+
_this._storage.removeItem('amplify-auto-sign-in');
|
|
11170
|
+
}
|
|
11171
|
+
|
|
11012
11172
|
resolve(data);
|
|
11013
11173
|
}
|
|
11014
11174
|
}, clientMetadata);
|
|
11015
11175
|
});
|
|
11016
11176
|
};
|
|
11177
|
+
|
|
11178
|
+
AuthClass.prototype.isTrueStorageValue = function (value) {
|
|
11179
|
+
var item = this._storage.getItem(value);
|
|
11180
|
+
|
|
11181
|
+
return item ? item === 'true' : false;
|
|
11182
|
+
};
|
|
11017
11183
|
/**
|
|
11018
11184
|
* Resend the verification code
|
|
11019
11185
|
* @param {String} username - The username to be confirmed
|
|
@@ -12689,7 +12855,7 @@ function () {
|
|
|
12689
12855
|
logger.debug('Getting current session'); // Purposely not calling the reject method here because we don't need a console error
|
|
12690
12856
|
|
|
12691
12857
|
if (!this.userPool) {
|
|
12692
|
-
return
|
|
12858
|
+
return Promise.reject(new Error('No User Pool in the configuration.'));
|
|
12693
12859
|
}
|
|
12694
12860
|
|
|
12695
12861
|
return new Promise(function (res, rej) {
|
|
@@ -13711,7 +13877,7 @@ function () {
|
|
|
13711
13877
|
|
|
13712
13878
|
AuthClass.prototype.rememberDevice = function () {
|
|
13713
13879
|
return __awaiter(this, void 0, void 0, function () {
|
|
13714
|
-
var currUser,
|
|
13880
|
+
var currUser, error_2;
|
|
13715
13881
|
return __generator(this, function (_a) {
|
|
13716
13882
|
switch (_a.label) {
|
|
13717
13883
|
case 0:
|
|
@@ -13728,8 +13894,8 @@ function () {
|
|
|
13728
13894
|
, 3];
|
|
13729
13895
|
|
|
13730
13896
|
case 2:
|
|
13731
|
-
|
|
13732
|
-
logger.debug('The user is not authenticated by the error',
|
|
13897
|
+
error_2 = _a.sent();
|
|
13898
|
+
logger.debug('The user is not authenticated by the error', error_2);
|
|
13733
13899
|
return [2
|
|
13734
13900
|
/*return*/
|
|
13735
13901
|
, Promise.reject('The user is not authenticated')];
|
|
@@ -13761,7 +13927,7 @@ function () {
|
|
|
13761
13927
|
|
|
13762
13928
|
AuthClass.prototype.forgetDevice = function () {
|
|
13763
13929
|
return __awaiter(this, void 0, void 0, function () {
|
|
13764
|
-
var currUser,
|
|
13930
|
+
var currUser, error_3;
|
|
13765
13931
|
return __generator(this, function (_a) {
|
|
13766
13932
|
switch (_a.label) {
|
|
13767
13933
|
case 0:
|
|
@@ -13778,8 +13944,8 @@ function () {
|
|
|
13778
13944
|
, 3];
|
|
13779
13945
|
|
|
13780
13946
|
case 2:
|
|
13781
|
-
|
|
13782
|
-
logger.debug('The user is not authenticated by the error',
|
|
13947
|
+
error_3 = _a.sent();
|
|
13948
|
+
logger.debug('The user is not authenticated by the error', error_3);
|
|
13783
13949
|
return [2
|
|
13784
13950
|
/*return*/
|
|
13785
13951
|
, Promise.reject('The user is not authenticated')];
|
|
@@ -13811,7 +13977,7 @@ function () {
|
|
|
13811
13977
|
|
|
13812
13978
|
AuthClass.prototype.fetchDevices = function () {
|
|
13813
13979
|
return __awaiter(this, void 0, void 0, function () {
|
|
13814
|
-
var currUser,
|
|
13980
|
+
var currUser, error_4;
|
|
13815
13981
|
return __generator(this, function (_a) {
|
|
13816
13982
|
switch (_a.label) {
|
|
13817
13983
|
case 0:
|
|
@@ -13828,8 +13994,8 @@ function () {
|
|
|
13828
13994
|
, 3];
|
|
13829
13995
|
|
|
13830
13996
|
case 2:
|
|
13831
|
-
|
|
13832
|
-
logger.debug('The user is not authenticated by the error',
|
|
13997
|
+
error_4 = _a.sent();
|
|
13998
|
+
logger.debug('The user is not authenticated by the error', error_4);
|
|
13833
13999
|
throw new Error('The user is not authenticated');
|
|
13834
14000
|
|
|
13835
14001
|
case 3:
|
|
@@ -14026,6 +14192,9 @@ var authErrorMessages = {
|
|
|
14026
14192
|
networkError: {
|
|
14027
14193
|
message: _common_AuthErrorStrings__WEBPACK_IMPORTED_MODULE_1__["AuthErrorStrings"].NETWORK_ERROR
|
|
14028
14194
|
},
|
|
14195
|
+
autoSignInError: {
|
|
14196
|
+
message: _common_AuthErrorStrings__WEBPACK_IMPORTED_MODULE_1__["AuthErrorStrings"].AUTOSIGNIN_ERROR
|
|
14197
|
+
},
|
|
14029
14198
|
"default": {
|
|
14030
14199
|
message: _common_AuthErrorStrings__WEBPACK_IMPORTED_MODULE_1__["AuthErrorStrings"].DEFAULT_MSG
|
|
14031
14200
|
}
|
|
@@ -14753,6 +14922,7 @@ var AuthErrorStrings;
|
|
|
14753
14922
|
AuthErrorStrings["NO_USER_SESSION"] = "Failed to get the session because the user is empty";
|
|
14754
14923
|
AuthErrorStrings["NETWORK_ERROR"] = "Network Error";
|
|
14755
14924
|
AuthErrorStrings["DEVICE_CONFIG"] = "Device tracking has not been configured in this User Pool";
|
|
14925
|
+
AuthErrorStrings["AUTOSIGNIN_ERROR"] = "Please use your credentials to sign in";
|
|
14756
14926
|
})(AuthErrorStrings || (AuthErrorStrings = {}));
|
|
14757
14927
|
|
|
14758
14928
|
/***/ }),
|
|
@@ -14886,6 +15056,7 @@ var AuthErrorTypes;
|
|
|
14886
15056
|
AuthErrorTypes["Default"] = "default";
|
|
14887
15057
|
AuthErrorTypes["DeviceConfig"] = "deviceConfig";
|
|
14888
15058
|
AuthErrorTypes["NetworkError"] = "networkError";
|
|
15059
|
+
AuthErrorTypes["AutoSignInError"] = "autoSignInError";
|
|
14889
15060
|
})(AuthErrorTypes || (AuthErrorTypes = {}));
|
|
14890
15061
|
|
|
14891
15062
|
function isUsernamePasswordOpts(obj) {
|