问题
I'm creating a custom web app and I'm using Google sign in to authenticate. I would like for the Choose an account screen, to only allow the user to chose a G Suite account to login to my web app. I'm aware of passing the param hostedDomain
with a single domain, array or an asterisk. When I use the asterisk as the value, the Choose an account screen display correctly, only showing accounts that are G Suite. The issue is that I get an error after selecting a G Suite Account.
Error: 'Account domain does not match hosted_domain specified by gapi.auth2.init.'
I don't want to specify which domain/domains that needs to be allowed. I want to allow all G Suite domains.
Is there such a thing? I feel like something like this shouldn't require too much. Currently, I'm thinking of just using the method getHostedDomain()
after a successful login if that return null or undefined then the current email/profile is not a G Suite account so logged them out before getting further into the web app.
Thanks in advance.
来源:https://stackoverflow.com/questions/60984997/only-allow-google-sign-in-with-g-suite-accounts