问题标签 [google-openidconnect]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1520 浏览

api - Using openid-connect for authentication spa and rest api

I have an API Server (Resource server) and multiple apps, Web GUI (SPA) and a Desktop client and maybe more coming. I'd like to use openid-connect besides http basic authentication for my API Server. It should be configurable which openid provider to use. My own, facebook, google... I only want to do authentication, I do not need their API. I only need some profile data like email or firstname.

Let's say I have configured google as my IdP and I'm currently using my Web GUI (SPA). I need to login, no problem, according to https://developers.google.com/identity/protocols/OpenIDConnect I redirect the user to google, get my authorization code and the Web Gui (SPA) gets an id_token and access_token from google.

No problem so far, but now the SPA has to work with my API Server and the API Server needs to authenticate every request (since it is a stateless rest api) coming from the Client (WebGui SPA) and needs to know which user actually did this.

A

So the access_token from google is meant to be used to access google api's right? But I also could just pass this access_token with every request to my api server and the api server calls https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=xxx to verify the access_token and get the account name (mail). But this doesn't sound right, does it?

B

I also have and id_token which I can verify without calling google server everytime. So could I also just pass the id_token as bearer with every request to my api server and the api server can verify the id_token? But according to openid-connect spec the access_token is actually the one which just get passed to the api server and the id_token must stay on the client. But then the id_token would be completely useless to me, the API server needs to know who the user is, the client (Web GUI) doesn't really care.

C

Or since it is my own API Server, does my API Server actually needs to implement the whole oauth2 system by itself, just not authentication but creating access_token and more. So I would have a /api/tokensign to which I can pass the id_token from google, the API verifies the id_token and creates an access_token for my WebGUI (SPA). And this new access_token can be passed as bearer to every api request. This actually sounds as the best solution according to specs, but do I really need to implement oauth2 by myself into my API? Sounds like a heavy addition since A and B could also be implemented.

My rest-api needs authentication with every request so is A, B, C the right approach? Please don't tell me this is opinion based, it is not. What is the right way using oauth2/openid-connect for authentication?

0 投票
1 回答
124 浏览

oauth-2.0 - Google Oauth2 防止重复的电子邮件地址?

我为一个组织创建了一个网站,用户可以使用其中的gsuite帐户登录google,比如说,用户john使用登录john@doe.com,然后执行他的todos操作。现在想象用户john离开了一个组织,另一个新用户叫做john,获取新的谷歌帐户john@doe.com,当新的约翰使用谷歌登录如何查看天气是新的还是旧的?

0 投票
1 回答
167 浏览

azure - 为什么 Azure AD B2C 为 Gmail 用户或其他 openid 连接用户创建用户?

我正在使用 Azure B2C 使用 OpenID onnect (Preview) 提供程序连接我自己的 openid 连接服务器。我配置了所有东西,系统工作正常。

但有一件事是当一个新用户通过我自己的 openid 连接服务器登录时,Azure AD B2C 在连接到 Azure B2C 的 Azure AD 中创建这个用户。

我的意图是,我的客户端应用程序必须调用 Azure B2C。Azure B2C 应显示身份提供者列表。这些提供商之一是我自己的 openid 连接服务器。然后用户可以在我自己的 openid 连接服务器中输入他的凭据并验证并使用 id_token 返回 Azure B2C。在此步骤之后,Azure AD B2C 要求我在 Azure AD 中创建此用户。为什么会这样?

我无法将我的用户详细信息提供给任何中间系统。请帮助我。

同样的情况也发生在 gmail 用户身上。但仅限于首次登录或我们更改某些登录策略属性时。

0 投票
0 回答
234 浏览

oauth-2.0 - Google Drive 的服务器到服务器应用程序的 OAuth 2.0 中的无效 grant_type 和无效凭据

执行完中提到的所有步骤后: https ://developers.google.com/identity/protocols/OAuth2ServiceAccount

并使用邮递员发出访问令牌请求:https: //www.googleapis.com/oauth2/v4/token

我收到以下错误:

我也尝试了没有 OAuth 的服务帐户授权,并收到错误:

可能是什么问题,我该如何解决?

0 投票
2 回答
815 浏览

oauth - 在 OAUTH/OpenID-Connect 之前询问用户名或唯一身份

我正在构建一个使用 OAuth2.0 和 OpenId-Connect(某些第三方供应商的)来验证用户身份的网站。

在将用户重定向到供应商的 OAuth 页面之前,我没有要求用户在我的网站上输入唯一的 UserID,我正在考虑使用我在授权过程完成后作为 IDToken 的一部分收到的用户的电子邮件 ID,因为我的网站的用户用户名(唯一身份)。

但是这里的 OpenID 规范
https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims

表示 emailid 是可选的,可能不会被退回。

所以问题是,在我启动 OAUTH/OpenID-Connect 流程之前,要求用户提供一个唯一的名称(我可以在我的网站上用作用户的身份)是一种标准做法吗?

0 投票
0 回答
538 浏览

google-oauth - 使用 auth_code 流对 https://oauth2.googleapis.com/token 端点的高延迟

一年多来,我们在我们的基础架构上广泛使用 Google Open ID Connect,并且到目前为止运行良好。

从昨天开始,我们开始在 GKE 集群的 pod 中体验来自https://oauth2.googleapis.com/token的缓慢响应(带有 DNS 解析的纯往返)。有人经历过吗?对此端点的部分调用需要长达 10 秒,并导致其他系统部分超时。

Google Open ID Connect 提供商是否有任何状态页面?像这样的 GCP:https ://status.cloud.google.com/ ?有发行说明吗?我们正在使用https://accounts.google.com/.well-known/openid-configuration来发现端点,这意味着我们应该使用最新的端点。我们仅使用身份验证代码流。

0 投票
2 回答
362 浏览

google-plus - G Suite Marketplace 上的“plus.me”范围应该替换什么?

到目前为止,我们在 G Suite Marketplace 上使用plus.me( https://www.googleapis.com/auth/plus.me) 范围来表示 OpenID Connect。但是“plus.me”范围将随着 Google+ API 的关闭而终止。

Google 登录(和 Google OpenID Connect)从“plus.me”替换为“openid”范围。我的代码已经迁移,但 G Suite Marketplace 不接受“openid”,因为它只接受 URL 格式。

在 G Suite Marketplace SDK 的配置中输入 openid 范围

G Suite Marketplace 上的“plus.me”范围应该替换什么?

更新:即使“openid”和“plus.me”都没有注册,我确认 OpenID Connect 在没有 OAuth 确认屏幕的情况下工作。

如果“openid”范围是不需要在 G Suite Marketplace SDK 上注册的规范并且该规范将保留,我希望获得 Google 编写的参考或听取 Google 员工的意见。

0 投票
1 回答
1725 浏览

scope - openid 范围“https://www.googleapis.com/auth/plus.me”会受到 Google+ 关闭的影响吗?

我想知道以下范围 URI 是否会受到 Google+ 关闭的影响。

此范围在 Google API 控制台的“OAuth 同意屏幕”选项卡中命名为“openid”,并在 URL 中包含“plus.me”。openid 范围是默认设置。

但是下面的 URL 说“只有直接请求 'plus.me' 范围的项目才会受到影响”。 https://developers.google.com/+/api-shutdown

它让我感到困惑......上述范围 URI 是否受到 Google+ 关闭的影响?

此外,我想确认以下每个范围和端点是否会受到影响,以防万一,因为我在我的项目中使用它们。

上述范围和端点是否会受到影响?

谢谢

0 投票
1 回答
485 浏览

asp.net-core - ASP.NET Core 身份验证通过 Google 登录,中间使用 REST API

我需要通过 Google 登录对 ASP.NET Core 应用程序进行身份验证,但是客户端应用程序(即 ASP.NET Core 应用程序)和 Google 登录之间的 Web API...我知道这听起来很混乱,所以让我解释一下图表。

这是包含谷歌登录按钮并通过他们的谷歌凭据对用户进行身份验证的典型方法,它工作得很好

第 1 步:首先,在 google 身份开发者门户网站上创建一个新应用,生成 ClientId、ClientSecret 并指定 redirect_url,例如: https ://yoursite.com/signin-google 。

第 2 步:在 ASP.NET Core 项目的 Startup.cs 类中,使用 AddGoogle 作为身份验证中间件,它可以正常工作。

包括下图以供您理解: 在此处输入图像描述

这是建议的流程。在客户端和谷歌登录之间使用 REST API。问题是,我如何验证客户端?

在此处输入图像描述

0 投票
2 回答
345 浏览

openid-connect - OpenID Connect:不同身份提供者之间的刷新令牌行为不一致

我正在实现一个服务提供者,目前观察到不同身份提供者在获取刷新令牌方面的不一致行为。我将在底部附上我的 Service Provider golang 代码,以防它可能对某人有所帮助或澄清我的问题。

我正在通过*/authn使用查询参数将登录请求重定向到端点来执行 authorization_code 流程access_type=offline。然后,第二步是在回调端点上接收授权码,然后调用*/token端点交换访问和刷新令牌的代码。

我用 3 个不同的身份提供者尝试了这个流程,发现了以下结果:

  1. OneLogin ( https://openid-connect.onelogin.com/oidcaccess_type=offline ):添加查询参数来接收刷新令牌就足够了。
  2. Okta ( https://my-company.okta.com ):添加access_type=offline还不够。我需要offline_access在第一步(authn)中添加到请求的范围参数。此配置也适用于 OneLogin!
  3. Google ( https://accounts.google.com ):但是,使用 Google,范围offline_access不受支持,并返回 400 BAD REQUEST:

    某些请求的范围无效。{valid=[openid, https://www.googleapis.com/auth/userinfo.profile , https://www.googleapis.com/auth/userinfo.email] , invalid=[offline_access]}

    与 Google 合作的唯一方法是offline_access从 Scopes 中删除并添加prompt带有 value的查询参数consent。但是,这不适用于 Okta 或 OneLogin ...

我是否遗漏了什么,或者我应该为每个 IdP 提供自定义授权流程实现,以支持刷新令牌?

考虑到该协议已完全指定,这似乎很奇怪。