Hello again, I'm implementing social login and wou...
# support-questions-legacy
a
Hello again, I'm implementing social login and would like redirect back to the page (and the state if possible) I was already in. I think we can pass something called a state to the google auth url, how do I pass that in when using: https://supertokens.com/docs/thirdpartypasswordless/custom-ui/thirdparty-login#step-2-handling-the-auth-callback-on-your-frontend. Also is it possible to login via a popup? That would allow me to preserve my app-state.
r
hey @aktopian
give me a moment. I'll highlight the steps required to do this.
a
Thanks 🙂
Also is there a way to open the auth url in a new tab and it gets automatically closed? That would be the best UX, considering mobile too.
I'm just looking for options for the best UX
r
@sattvikc can help here.
s
@aktopian you can do the following:
on the login route:
Copy code
const wnd = window.open(authURL, "Login", "width=800,height=600")
const timer = setInterval(function() {
    if(wnd.closed) {
        clearInterval(timer);
        alert('login complete');
        // Check for session here
    }
}, 1000);
you would do the popup instead of doing
window.location.replace
and on the call back route simply call
window.close()
once the signInUp is done
if you wish to send success or error state, you could do that using the localStorage
a
That's a nice idea, thanks. Any gotchas for mobile?
s
you want to implement browser login for a mobile app ?
a
Not a mobile app
Just the pop up in mobile
s
same code should work
a
Yup, thanks 👍