@annalib/anna-cognito-lib 2.2.34 → 2.2.35

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.
@@ -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
+ 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,7 +328,11 @@ class AnnaLibAuthService {
323
328
  }
324
329
  return errorMessage;
325
330
  }
326
- signInWithSSO() {
331
+ async signInWithSSO() {
332
+ let session = await fetchAuthSession();
333
+ if (session?.tokens) {
334
+ await this.handleSignOut();
335
+ }
327
336
  this.consumingProjectAuthService.signInWithSSO();
328
337
  }
329
338
  async handleSignOut() {