我需要按组织对 Google 个 Apps 用户进行分组

I need to group Google Apps users by their Organization

这是我正在尝试做的事情:

当人们使用 Google Apps OAuth 登录我们的应用程序时,他们会在应用程序中按其组织自动分组。

我们已经在 Slack 上这样做了,用户登录后说他们想从哪个团队登录,他们会自动与 Slack 团队的其他人分组。

加上Google,好像有点复杂。我不需要访问组织内的任何内容:没有用户列表、没有其他电子邮件、没有文件。我只需要组织的名称和某种唯一标识符。

这可能吗?我一直在研究 this 但没有取得太大成功:似乎应用帐户的管理员必须安装或批准该应用程序?

我越来越觉得这必须通过 Marketplace 进行设置,但从我们的角度来看,这远非理想。

能做到吗?

您想要的是 hd ID Token 的声明。这代表工作用户 Google 的 "hosted domain",即他们的组织。

如果您使用 Google Sign-in library, you will be able to get the ID Token of the user, once you have that you can extract the hd claim. Try these docs: web, ios, android.