Hi, I’m using netlify-auth-providers on my site relaxed-thompson-94b498 (mostly still testing on localhost though). I’m authenticating with GitHub in order to use their API. When I don’t have an access token I go through the netlify authenticate() method which pops up the window to let the user log in, which is fine.
However, once I’ve signed in if I open a new tab (which doesn’t have an access token) when it calls authenticate that causes the pop-up to open but it immediately disappears without the user actually having to sign in and then I get the access token I need. Which is all fine except it’s annoying that the pop-up appears and disappears.
Is there anyway to have it not open the pop-up if it’s going to be able to authenticate to github without user intervention?
I don’t believe so. Every OAuth call needs a call made to the provider. The provider then tells that the user is already logged in - you can use this token, which is why the window then closes.
You might have noticed the same behaviour on Netlify UI, when adding a repo from the Git providers. You can see the same behaviour on various other OAuth-based sites using different services. They’ll prompt you to login, you click on the button, it opens a new tab, the provider where you’re already logged in simply returns the token and the tab closes. Except, Netlify does this in a pop-up instead of a tab.
Yeah, I had subsequently kind of figured out that much. So I assume if I wanted to have it happen in a tab rather than a pop up, I’d have to handle the OAuth redirect myself? Not that the pop up is a big deal, but just curious.
Yes, you’d have to somehow integrate the OAuth yourself.