简体   繁体   English

如何为我的Android应用启用Google登录,使其仅允许来自特定Google域的用户登录?

[英]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.

相关问题 如何从Android WebView进行Google登录,并在成功登录后重定向回首页? - How to do google sign-in from an Android WebView and after successful sign-in redirect back to the home website? 我可以在NavigationView Items中的Android应用中使用Google登录吗? - Can I use Google sign-in in my Android app in NavigationView Items? 无法在 Android 应用程序中使用 Google 登录 - Unable to sign-in using Google in Android App 登录后如何关闭谷歌登录窗口 - android 应用程序 - how close google sign-in window after signing in - android app 我怎样才能在Android上取消谷歌加登录链接? - How could I unlink a google plus sign-in on Android? 从 google+ 登录迁移到新的 google 登录 - Migrating from google+ sign-in to new google sign-in 如何仅使用Google Android应用中的Google Drive API在Google云端硬盘上创建和编辑电子表格文件? - How do I create & edit a spreadsheet file on google drive using Google Drive APIs only from my Android app? 将 Firebase 应用与 Google Sign In 结合使用时,如何使用我的 Google Cloud Function 进行身份验证? - How do I authenticate with my Google Cloud Function when using my Firebase App with Google Sign In? Google 登录不适用于已发布的应用 - Google Sign-In not working on published app Android Studio Google登录不起作用 - Android Studio Google Sign-In not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM