nango icon indicating copy to clipboard operation
nango copied to clipboard

pizzly-js open oauth in same window (to avoid pop-up blockers)

Open timmyg opened this issue 4 years ago • 2 comments

Is there a way to open the oauth flow in the same window? I am getting rejected from shopify app store review.

"don't use pop-up windows for essential app functionality like running OAuth. This protects the functionality of your app from being compromised by pop-up blockers."

Willing to do a PR if you all think this is something doable. If so, a point in the right direction would be great. Thanks!

timmyg avatar Feb 25 '21 21:02 timmyg

I am assuming it is around here: https://github.com/Bearer/Pizzly/blob/56fbc55e4543028610757e6e699623be14996944/src/clients/javascript/src/connect.ts#L89

Wondering if I am going down a rabbit hole though. If it goes to a new page, obviously I wont get a clean callback with the authId as intended with this library...

timmyg avatar Feb 25 '21 21:02 timmyg

I'm not sure if there is a particularly good solution to this out of the box, as for most (perhaps all) Pizzly users they would lose the current app state when the page change happens.

You would need some client-side route to catch the callback, then send the payload back up to the Pizzly server (using Pizzly's API routes). At that point much of the benefits of using the drop-in client are pretty much lost.

You could maybe build some helper functionality into the client to handle that transfer, but the end user still needs to manage all the routing on the client, so it would be more of a util addition than a configuration change.

Happy to hear any proposals that could resolve the issue though.

markmichon avatar Feb 28 '21 18:02 markmichon