问题标签 [oauth2]

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 回答
3740 浏览

oauth2 - 一个客户端可以同时为 Google 拥有多少个刷新令牌和访问令牌?

提供,我有一个谷歌应用程序,用户多次使用 OAuth2 授权我的应用程序,并且我的应用程序存储了从授权生成的所有刷新令牌。我的应用可以保留多少个有效的刷新令牌?每个刷新令牌生成的访问令牌有多少是有效的?

0 投票
1 回答
770 浏览

python - 通过python的Linkedin 401错误

尝试使用 Python 访问 LinkedIn Developer API,但在调用 linkedin API 时出现 401 错误。你能帮忙吗-

详细代码如下 -

0 投票
1 回答
430 浏览

api - symfony 2 oauth 保护的 api 服务器到服务器

我想在 Symfony 2.8 中创建一组使用 Oauth2 协议保护的 API。

OAuth 服务器使用 FOSOAuthServerBundle 实现,并与 API 集位于同一服务器中。

客户端应用程序应通过 HWIOAuthBundle 与 API 服务器通信,但它们应代表应用程序本身而不是第三方用户进行此操作。在 Google API 中,这称为 2 腿 oauth 身份验证。

显然客户端应用程序不能通过表单发送用户名和密码数据,所以我想知道它是否存在一个包或其他方法来为客户端应用程序自己登录公开 oauth 身份验证,或者我应该简单地扩展 HWIOAuthBundle 控制器。

0 投票
2 回答
902 浏览

php - OAuth2.0 server grant type user credentials password is not encrypted

I am also following what this guy's asking storage of client credential on OAuth2 server about oauth2-server-php-docs. Although it answered one thing for the client secret, I wanna ask about the users credentials. Check the following code sample from oauth2-server-php-docs:

It says that the user credentials will be stored in memory and that it doesn't say anything about password encryption. This is my use case -- I already have user credentials stored in MySQL with password encrypted using PHP password_hash(). So how can I match or use the line $storage = new OAuth2\Storage\Memory() if the $user['bshaffer']['password'] is just a plain text?

0 投票
1 回答
133 浏览

azure - AdalJS/openid/oauth2 是否支持电子邮件、地址和电话范围类型?

我正在使用AdalJS v1.0.8 库来授权用户使用 Azure AD 端点,并且想知道AdalJS/openid/oauth2 中是否支持、和的&scope类型。emailaddressphone

我的授权端点 URL:

https://login.microsoftonline.com/ {tenant id}/oauth2/authorize?response_type=id_token&client_id={client id}&redirect_uri={我的重定向 uri}&state=2af81ff1-89ca-4f23-825d-ca29177c3df5&client-request-id= 2f82e417-630b-4318-88ed-c35103046249&x-client-SKU=Js&x-client-Ver=1.0.7&nonce=4c03cbca-03b2-4a53-acc6-1177f499969a&prompt=login&scope=openid+profile+email+address+phone

登录页面出现并且用户输入他们的凭据后,令牌成功返回,我可以profile在调用时看到用户的对象AuthenticationContext.getCachedUser()。但是,即使在查询字符串参数中请求了这些范围类型email,我也没有看到返回的信息addressphone&scope

AuthenticationContext.getCachedUser 结果 配置文件对象

0 投票
2 回答
688 浏览

node.js - 使用 OAuth2 在 node.js 中获取刷新令牌和 gmail 用户配置文件

我想在 node.js 中使用 simple-oauth2 授权我的应用程序中的 gmail 登录,并尝试获取用户配置文件,最初我进行身份验证,代码是

// 授权uri定义

回调是,

令牌的结果是这样的:

在令牌响应中,我无法获得刷新令牌。还有其他方法可以获取刷新令牌吗?

以及登录成功后如何获取登录用户的个人资料详细信息。请提出一些解决方案..!提前致谢 !!

0 投票
0 回答
1449 浏览

node.js - SSLv3 方法禁用 Google oauth2 请求上的错误

我尝试了各种 Oauth2 包,试图将我的 Node 应用程序与 Google 的 oauth2 服务连接起来——我过去已经成功地做到了这一点。

现在,无论我尝试什么,我都会遇到相同的错误,即“ SSLv3 methods disabled ”。我知道这是 Node 中最近发生的一项更改,即禁用 SSLv3 以防止 SSL 中的 POODLE 漏洞。我的测试表明,如果您不向请求对象提供密钥和证书,则一切都默认为 SSLv3(这显然已损坏)。

问题是——流行的 google oauth2 软件包似乎都不允许选择将您自己的密钥和证书传递到请求中。我可以用猴子修补自己的钥匙,但是,考虑到这应该会影响很多人,我觉得我错过了一些东西和/或做错了什么。

有人遇到这个问题并有更直接的解决方案吗?

这是堆栈跟踪;

如前所述,如果我提供自己的密钥,则手动进行直接 SSL 连接没有问题。以下代码工作正常;

0 投票
2 回答
393 浏览

openam - 如何使用 Forgerock OpenAM 和 OAuth2 实现用户“自动批准”

我想使用 OpenAM 作为 IAM 平台。另一方面,我想保护并提供对使用 OAuth2 的 REST 服务层的细粒度访问,OpenAM 扮演 OAuth2 服务器/提供者的角色。

这已经对我有用,但是在这种情况下,我希望用户确认访问的屏幕不会出现。原因是在这种情况下,我并没有真正使用 OAuth2 进行委派。归根结底,我希望我的 REST 服务层受到保护。用户甚至不应该意识到我们正在为此目的使用 OAuth2。

是否有“自动批准”功能(类似于 Spring OAuth2 框架中的现有功能)来明确避免向用户显示批准屏幕并自动批准?我查看了 OpenAM 文档,但找不到任何东西..

任何帮助将不胜感激。谢谢!

0 投票
1 回答
730 浏览

angularjs - OAuth2 with Satellizer and a generic OAuth2 provider

I'm having much trouble getting OAuth2 to work with a generic OAuth2 provider. Here's the situation.

A service provides an OAuth2 authentication method to where I want to authorize with. I've created an AngularJS app that has the following configuration for satellizer:

The baseUrl points to my node server that should handle the middleware part.

I've also the following code that triggers the authentication part.

So far this all seems to work great and looks very similar to what is documented by Satellizer! Now once I start the angular app and start the authentication I see requests coming by that target my Node service.

Next I've my node.js service that hooks to the 'user/authorize/token' URL. Here's the code:

and:

Here's where it all seems to go wrong. First I seem to get an OPTIONS request. I've not really an idea what to do with it as I can't seem to find anything in the documentation about an OPTIONS request. I thought it would might contain the 'Authorization' header but that doesn't seem the case so I close the connection with a res.end();

I also inspected the request in Chrome but I can't seem to find a header that has this exact name.

Next I get a POST request. This does seem to contain some things, hooray! I get the following object:

This looks to me like the authorization code that I should have to decode. That's what you see me trying as well in the code above. Unfortunately this seems to throw me an error

Error: Not enough or too many segments

This tells me I'm doing probably something wrong, and I got stuck.

I do have some PHP code that seems to work for someone else but I don't fully understand and can't really relate the code to my code since PHP is not my speciality and node.js/JavaScript not his. So here goes the PHP code:

Hopefully someone can help me out! Thanks in advance.

0 投票
1 回答
3849 浏览

spring - Spring OAuth2.0 - 动态注册 OAuth2.0 客户端

我正在使用 Spring 安全性设置 OAuth2.0 授权服务器。我想知道在 OAuth2.0 授权服务器启动并运行后是否有办法动态注册 OAuth2.0 客户端?

基本上,我知道我可以在配置 OAuth2.0 服务器时注册客户端,方法是扩展AuthorizationServerConfigurerAdapter并覆盖 configure 方法以在内存中添加客户端详细信息。但是,这种方式客户端是预先注册的,我想知道如何动态添加客户端详细信息。

@Override public void configure(ClientDetailsServiceConfigurer clients) throws Exception { // @formatter:off clients.inMemory() .withClient(CLIENT_ID) .secret(CLIENT_SECRET) .authorizedGrantTypes("authorization_code", "implicit") .redirectUris("http://junk/") .scopes("cn") .accessTokenValiditySeconds(600); // @formatter:on }