[英]How do I enable Google sign-in for my Android app such that it only allows users from a specific Google domain?
I have currently integrated stock Google sign-in for my app. 我目前已为我的应用集成了Google股票登录功能。 I now want it to restrict sign-in from only one specific Google domain.
现在,我希望它仅限制从一个特定的Google域登录。 eg john.doe@xyz.com.
例如john.doe@xyz.com。 I only want users from the xyz domain to be able to sign in. I'm guessing there is a better solution than regex matching.
我只希望xyz域中的用户能够登录。我猜有比regex匹配更好的解决方案。 I have read about openid connect for sign-in but I'm only finding info related to web apps.
我已经阅读过用于登录的openid connect信息,但只找到与Web应用程序相关的信息。
I would limit the user input to be only the e-mail address before the @. 我将用户输入限制为仅@之前的电子邮件地址。 I would create a
TextView
(or something) to hold the domain I want people to use and place it on the side of the EditText
. 我将创建一个
TextView
(或其他东西)来容纳我希望人们使用的域,并将其放置在EditText
的侧面。 This would make people insert only what comes before the @. 这将使人们仅插入@之前的内容。 I would limit the use of certain characters as well (@, for example).
我也会限制某些字符的使用(例如@)。 And last, I would add the domain I want people to use when they pressed the login button.
最后,我要添加人们希望在他们按下登录按钮时使用的域。
String domain = "@xyz.com";
String login = editText.getText() + domain;
Yeah, something like this. 是的,像这样。 But well done and well thought.
但是做得好,思想也好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.