Skip to content

Commit

Permalink
fix: only register auth urlListener from InternalAuth instance (#11810)
Browse files Browse the repository at this point in the history
  • Loading branch information
erinleigh90 authored Aug 16, 2023
1 parent 10c6868 commit bee9c8e
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 @@ -260,14 +260,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 bee9c8e

Please sign in to comment.