Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popup won’t open on Mobile Safari #2189

Open
parisetflorian opened this issue May 21, 2024 · 5 comments
Open

Popup won’t open on Mobile Safari #2189

parisetflorian opened this issue May 21, 2024 · 5 comments
Labels

Comments

@parisetflorian
Copy link

parisetflorian commented May 21, 2024

Triggering the auth workflow on mobile safari won’t open the popup.

Copy link

linear bot commented May 21, 2024

@linear linear bot added the GitHub label Jun 7, 2024
Copy link
Member

Is this still happening?

@parisetflorian
Copy link
Author

@bastienbeurier Yes! I just tested right now. Works fine on chrome but I get this on Safari:
TypeError: null is not an object (evaluating 'this.modal.location = this.url + '&ws_client_id=' + wsClientId')

@henrymgarrett
Copy link
Contributor

@parisetflorian What safari version and iOS version/phone are you on?

@GeKorm
Copy link

GeKorm commented Jun 24, 2024

Hi! I suspect the problem is that this window.open() call happens in an async context when the AuthorizationModal is instantiated in a Promise.
Most browsers block window.open if it's not a result of direct user interaction, but Safari iOS is especially strict about it. I've even found it problematic in sync contexts when it was a couple functions deep in a click handler.

Even after a potential fix for the Promise, it might be necessary to educate users about this, which is why some SDKs may provide a controlled button, or allow users to pass a reference to their own button and attach an event listener to it, eg:

const nango = new Nango({ publicKey: '<PUBLIC-KEY>', authButtonId: '<github-login>' });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants