@annalib/anna-cognito-lib 2.2.34 → 2.2.36
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/esm2020/lib/services/auth.service.mjs +16 -3
- package/fesm2015/annalib-anna-cognito-lib.mjs +16 -1
- package/fesm2015/annalib-anna-cognito-lib.mjs.map +1 -1
- package/fesm2020/annalib-anna-cognito-lib.mjs +15 -2
- package/fesm2020/annalib-anna-cognito-lib.mjs.map +1 -1
- package/lib/services/auth.service.d.ts +1 -1
- package/package.json +1 -1
|
@@ -163,6 +163,10 @@ class AnnaLibAuthService {
|
|
|
163
163
|
}
|
|
164
164
|
async handleSignIn({ username, password }) {
|
|
165
165
|
try {
|
|
166
|
+
let session = await fetchAuthSession();
|
|
167
|
+
if (session?.tokens) {
|
|
168
|
+
await this.handleSignOut();
|
|
169
|
+
}
|
|
166
170
|
const { isSignedIn, nextStep } = await signIn({ username, password });
|
|
167
171
|
switch (nextStep?.signInStep) {
|
|
168
172
|
case "DONE":
|
|
@@ -183,6 +187,7 @@ class AnnaLibAuthService {
|
|
|
183
187
|
}
|
|
184
188
|
}
|
|
185
189
|
catch (error) {
|
|
190
|
+
console.log(error);
|
|
186
191
|
this.consumingProjectAuthService.isLoggingIn = false;
|
|
187
192
|
if (error?.message == LoginConstant.tempPasswordExpiryError) {
|
|
188
193
|
this.loginErrorMessage = LoginConstant.tempPasswordOnExpiryErrorMsg;
|
|
@@ -323,8 +328,16 @@ class AnnaLibAuthService {
|
|
|
323
328
|
}
|
|
324
329
|
return errorMessage;
|
|
325
330
|
}
|
|
326
|
-
signInWithSSO() {
|
|
327
|
-
|
|
331
|
+
async signInWithSSO() {
|
|
332
|
+
let session = await fetchAuthSession();
|
|
333
|
+
if (session?.tokens) {
|
|
334
|
+
await this.handleSignOut().then(response => {
|
|
335
|
+
this.consumingProjectAuthService.signInWithSSO();
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
this.consumingProjectAuthService.signInWithSSO();
|
|
340
|
+
}
|
|
328
341
|
}
|
|
329
342
|
async handleSignOut() {
|
|
330
343
|
try {
|