问题标签 [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 回答
12983 浏览

javascript - 由于重定向 URI 无效,Keycloak 令牌请求被拒绝

升级到 Keycloak 版本 1.9.1 后,我们开始keycloak.js在获取基于代码的令牌时遭到拒绝。

如果我们输入基本 url ( http://example.com ),那么应用程序工作正常,登录成功并检索到令牌。

不幸的是,当进入这个子页面时(https://example.com/?redirect_fragment=/asset-library/card-view/ - 它是从带有redirect_fragment编码的javascript发送的,但在keycloak日志中,它在这个片段解码后可见)我们得到成功登录并获取代码后获取令牌时出现错误400。准确的回应是:

这是为什么?在 keycloak 中的有效重定向 uri 中,我们有(以防万一):

以下是使用重定向 URI beeing http://example.com成功登录的日志:

以下是重定向 URI 为https://example.com/?redirect_fragment=/asset-library/card-view/的登录失败日志:

0 投票
1 回答
1320 浏览

django - Django-allauth OAuth2 刷新令牌

使用 django-allauth 进行 OAuth2 身份验证时,我可以使用以下内容找到 OAuth 令牌(bitbucket_oauth2 是示例中的提供者):

此令牌仅在一个小时内有效。刷新令牌存储在哪里?

0 投票
1 回答
129 浏览

ibm-cloud - Box login - 如何在 localhost 和生产环境中开发 opn?

我有:

  • 一个使用 Box Content API 的 Node.js 应用程序,并且...
  • 一个 Box 应用程序,这样我就可以在我的 Box 存储库中注册 Oauth2 client_id、client_secret 和 redirect_uri。

我当前的 redirect_uri 是“http://localhost:3000”。如果我在本地运行,该应用程序运行良好,如果我部署到 Bluemix(例如“ https://myapp.mybluemix.net ”),它会惨遭失败。

我相信您可以在 Facebook 和 Google 中为单个 Oauth2 client_id/client_secret 注册多个 redirect_uris,但我在 Box 中看不到任何解决方法。除了创建第二个应用程序...

这些帖子很相似,但我不需要向单独的 OAuth2 服务器进行身份验证……我只需要从两个不同的环境(我的 Node 应用程序本地,与 Bluemix 上的同一个 Node 应用程序)进行身份验证。

问:有什么方法可以为同一个Box 应用注册多个 redirect_uris?

附录:

  1. 感谢 Murtza Manzur 的回复:

Box 不支持多个域重定向 URI。要使用不同的域(localhost 和 mybluemix.net),您必须为每个域创建一个单独的应用程序。

  1. 这意味着我需要两个 Box 应用程序,并且我需要配置我的 Bluemix/Node 应用程序以使用其中一个。

  2. 以下是关于如何在 Bluemix 中高效、安全地执行此操作的精彩讨论:

0 投票
1 回答
183 浏览

azure - Error AADSTS90093 on Microsoft "converged" OAuth authorize for organizational O365 account

I'm developing an application that I registered with Microsoft at apps.dev.microsoft.com to use their new "converged" OAuth2 flow documented at https://azure.microsoft.com/en-us/documentation/articles/active-directory-v2-protocols-oauth-code/.

I am requesting authorization for scope user.read. Specifically, this is the authorize URL:

I expect this to work 100% of the time as I'm only asking for the user.read scope, which is documented at https://graph.microsoft.io/en-us/docs/authorization/permission_scopes as not requiring delegation. However, for my corporate (aka organizational) account, when I login to the authorize URL I get the error AADSTS90093: Does not have access to consent. My corp organizational account is a regular user role in our AAD.

Every other authorize request works as expected. I've tested this with other organizational accounts who are admins, contributors, and regular users in other Azure accounts I have. I've tested this with "MSA" accounts (outlook.com, hotmail.com, other Live-registered accounts) too.

The only differences in accounts that I can think of:

  • The account that fails is an Office 365 account. (Every other test I've done with an organizational account has been me manually entering the account in AAD in "the old portal".)

  • The account that fails is the account under which I registered the app on apps.dev.microsoft.com (Oh the irony!)

Anyone encountering this? Do you see anything wrong with the authorize URL or the authorization scope? Is there some setting in AAD or in Office 365 that could prevent third-party OAuth access to "myself"?

0 投票
1 回答
903 浏览

node.js - 如何将 OAuth2 用于 CLI?

我正在构建客户端和服务器应用程序以协同工作。这两个应用程序都是使用节点构建的。服务器应用程序将被托管,客户端应用程序将可供用户下载。对于身份验证,我决定使用 OAuth 2。

根据 OAuth 规范,它涉及由客户端 ID 和客户端密码组成的客户端实体。我理解为什么以及如何在用户授予对特定网站的访问权限的 Web 服务方面使用它,但我不明白在任何用户都可以访问两者的 CLI 应用程序中应该如何使用它。

在我看来,在代码中的某处硬编码客户端 ID 和客户端密码是没有意义的。有人可以解释一下这种应用程序应该如何工作吗?

0 投票
0 回答
252 浏览

spring - Spring 安全 Oauth 和 SSO

谁能告诉我是否可以将 Spnego 的 SSO 和 Spring 安全性与 Oauth 结合起来

这是我的问题:我现在代表的客户选择 Spnego 作为他们的 SSO 解决方案。这要求我们在所有场景中都使用成熟的 appServer (Liberty)。同时,开发团队中关于Spnego的知识和技能也非常有限。

由于创建 keytab 文件的问题,Spnego 仅在正式测试环境中可用,而不是在我们的本地测试环境中可用。由于正式测试环境的部署时间长,这使得测试和开发非常困难/耗时。没有结束我的问题:

如果可能的话,我希望能够使用 SPNEGO SSO “登录”到正式测试环境(OAUTH2 身份验证服务器?)中的服务,并获得一个令牌,我可以在进一步请求本地和/或我的服务时使用它在任何其他测试环境中。这甚至可能吗?我还没有看到 authenticationServer 使用另一个 sso 提供程序来实际验证用户的任何示例。

另一种可能性可能是在测试环境中从登录服务进行某种重定向,但我担心仅创建的 Spnego 令牌将在同一域中的服务器上有效..

如果这个问题令人困惑或不清楚,我很抱歉。我对这个领域(安全性)的了解是有限的,我很难掌握如何在启用安全性的情况下在本地测试我的代码。

将不胜感激链接到网络上解决其中一些问题的任何资源。

0 投票
1 回答
450 浏览

node.js - 在 Azure OAuth 中获取新令牌(使用 refresh_token)从 NodejS 提供 404,从 cURL 可以正常工作

我正在尝试从 Azure 获取新令牌,但出现 404 错误。当我转储请求正文和参数,然后将其转换为 cURL 请求时,一切正常。有什么想法吗?

请求正文:

我知道令牌和客户信息是正确的,因为它适用于 curl..

我正在使用 Node 的https.request库进行调用。有任何想法吗?

0 投票
1 回答
60 浏览

angularjs - 无法使用 curl 通过 tut-spring-security-and-angular-js “pairs-oauth2” 示例调用资源

我遵循Spring Security and Angular JS - A Secure Single Page Application tutorial 并从 GITHUB 下载了它的源代码。我正在尝试使用“client_credentials”grant_type 模拟远程应用程序访问“资源”api。

通过发出以下命令,我可以很好地获取令牌:

这给了我以下令牌:

但是,当我尝试使用令牌访问 API 时

我收到 302 响应并被重定向到登录页面。以下是身份验证服务器的输出:

我确实更改了 OAuth2AuthorizationConfig 以添加“client_credentials”授权类型

但我一定错过了别的东西。非常感谢任何帮助!

0 投票
1 回答
171 浏览

angularjs - URL路径中的Spring安全oauth2和角度JS令牌?

我正在使用前端的 angular-js 和后端的 Spring 创建一个 Web 应用程序。为了安全起见,我正在使用 spring 的 oauth 2 令牌身份验证。通过生成令牌,我已经使一切正常运行。我还可以通过有角度的 $http 拦截器将它们注入到我的 post 调用中。但是,我有一个小问题,一旦登录,我无法导航到主页,除非我的 URL 中出现了令牌????!!!?!我该如何摆脱它?现在它看起来像这样:

http://localhost:7001/app/console?access_token=7f7733bd-edbd-4de3-b192-a8059a89c461

0 投票
0 回答
279 浏览

twitter - Twitter oauth2/token 教程总是出错

我按照教程提出请求以获取带有令牌的响应。但总是得到错误。

这是来自...的教程
https://dev.twitter.com/oauth/reference/post/oauth2/token

这是我使用的邮递员的请求。

有人可以帮助我吗?请。