我们如何从电子邮件ID中检查特定域是否使用谷歌应用程序作为其电子邮件ID?

时间:2022-05-14 00:28:11

My project involves g+ sign as well as normal sign in. If the user uses g+ sign in, I am prompting user with some consent screen to access contacts. If the user is using normal flow with some gmail id(also business id created by google apps), then I want to show a button - Import contacts from gmail and on click I will prompt consent screen. If he is using not gmail based email id, then I won't show that button at all. How can I find email id used is created by a google apps?

我的项目涉及g +标志以及正常登录。如果用户使用g +登录,我会提示用户在某个同意屏幕*问联系人。如果用户正在使用具有一些gmail id的正常流程(也是由谷歌应用程序创建的业务ID),那么我想显示一个按钮 - 从gmail导入联系人,点击我将提示同意屏幕。如果他使用的不是基于gmail的电子邮件ID,那么我根本不会显示该按钮。如何查找使用的电子邮件ID是由谷歌应用程序创建的?

For example:

Consider the business emails for an organization 'sense.com' is created by google apps,and the mail id is say 'jerry@sense.com'. Is there a way to find just from 'jerry@sense.com', the mail id created by google apps? So that I will show button.

考虑组织'sense.com'的商业电子邮件是由谷歌应用程序创建的,邮件ID是'jerry@sense.com'。有没有办法找到谷歌应用程序创建的邮件ID'jerry@sense.com'?这样我就会显示按钮。

1 个解决方案

#1


0  

I used Google Asmin SDK to deal with Google Apps accounts.

我使用Google Asmin SDK处理Google Apps帐户。

var service = new Google.Apis.Admin.Directory.directory_v1.DirectoryService(new BaseClientService.Initializer
                {
                    HttpClientInitializer = result.Credential,
                    ApplicationName = "My Application"
                });

var list = await service.Users.Get("somebody@sense.com").ExecuteAsync();

This returns the Google user account details if it's a valid account. But you need Authorized credentials (result.Credential) as the OAuth example in here . Hope you are already familiar with that.

如果Google帐户是有效帐户,则会返回Google用户帐户详细信息。但是您需要授权凭据(result.Credential)作为此处的OAuth示例。希望你已经熟悉了。

You can try more features with the adminSDK in Google API explorer.

您可以在Google API资源管理器中使用adminSDK尝试更多功能。

Hope this will help you!

希望对你有帮助!

#1


0  

I used Google Asmin SDK to deal with Google Apps accounts.

我使用Google Asmin SDK处理Google Apps帐户。

var service = new Google.Apis.Admin.Directory.directory_v1.DirectoryService(new BaseClientService.Initializer
                {
                    HttpClientInitializer = result.Credential,
                    ApplicationName = "My Application"
                });

var list = await service.Users.Get("somebody@sense.com").ExecuteAsync();

This returns the Google user account details if it's a valid account. But you need Authorized credentials (result.Credential) as the OAuth example in here . Hope you are already familiar with that.

如果Google帐户是有效帐户,则会返回Google用户帐户详细信息。但是您需要授权凭据(result.Credential)作为此处的OAuth示例。希望你已经熟悉了。

You can try more features with the adminSDK in Google API explorer.

您可以在Google API资源管理器中使用adminSDK尝试更多功能。

Hope this will help you!

希望对你有帮助!