What I’m trying to do:
Allow users to sign in and up with google.
What I’ve tried and what’s not working:
The anvil.google.auth.login() and signup() functions are creating an intermediary pop-up.
It is hard to style and seems unnecessary. Is there any way to avoid it?
Modern browsers have strict popup blocker policies. Popup windows must be opened in direct response to user input
In other words, if your button handler is doing a server call prior to calling anvil.google.auth.login(), then the browser will not open the authentication window popup because it is no longer in direct response to the user clicking the button.
If that doesn’t seem like what’s happening then we’ll need a little more information to help.
I am also getting this behaviour, it is weird since I do not do any of the server calls prior to the login click.
Also, I’ve noticed that if I invoke the login_with_google from a button click, all is well. However I have a custom html form, and invoke from there, I get this weird behaviour.
Yes, that sounds about right. The fail safe is based on anvil button/link click handlers.
I’m moving this to bug reports, and we’ll get that fixed so that the auth window popup will be invoked when using custom buttons that run synchronously.
For now, if you’re able to use an anvil button, all should be well, and we’ll report back when we’ve fixed this issue.
Inspired by @augustas.volbekas I created a slot in my custom HTML and dragged a button in.
This way it works instantly. I am sure it can be done in an acceptable way to make it look good. Possibly a link with the same classes on it.