Skip to content

Commit

Permalink
fix: only register auth urlListener from InternalAuth instance (aws-a…
Browse files Browse the repository at this point in the history
  • Loading branch information
erinleigh90 authored and kvramyasri7 committed Aug 18, 2023
1 parent bc9f9c0 commit 453fd25
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/auth/src/internals/InternalAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,17 @@ export class InternalAuthClass {
// Prevents _handleAuthResponse from being called multiple times in Expo
// See https://github.com/aws-amplify/amplify-js/issues/4388
const usedResponseUrls = {};
urlListener(({ url }) => {
if (usedResponseUrls[url]) {
return;
}
// Only register urlListener once
if (this.getModuleName() === 'InternalAuth') {
urlListener(({ url }) => {
if (usedResponseUrls[url]) {
return;
}

usedResponseUrls[url] = true;
this._handleAuthResponse(url);
});
usedResponseUrls[url] = true;
this._handleAuthResponse(url);
});
}
}

dispatchAuthEvent({
Expand Down

0 comments on commit 453fd25

Please sign in to comment.