Oauth2-basic 插件 和 pkce

Hello all,

I’m new to the oauth2-basic plugin and after reading the docs and source code, I cannot find an answer to my question.

  • Does the oauth2-basic plugin support pkce?
  • If so, how can I enable that?
  • If not, how might I modify the oauth2-basic plugin code to use pkce?

The omniauth github page README says that I should be able to set the pkce option to true in my omniauth strategy. However, I have attempted this change in the oauth2-basic plugin code and no code challenge is being sent to my authorize_url. Any suggestions?

Thanks in advance

3 个赞

我正在协助的一个社区要求支持 PKCE,因此我在此跟进。

在此之前,我还没有看到任何关于此的信息,但通过查阅相关文档,它似乎是原生应用和 SPA 的主要驱动因素:

原生应用

  • 无法安全地存储客户端密钥。反编译应用程序将暴露客户端密钥,该密钥与应用程序绑定,并且对所有用户和设备都相同
  • 可能会使用自定义 URL 方案来捕获重定向(例如,MyApp://),这可能会允许恶意应用程序从您的授权服务器接收授权码

单页应用

  • 无法安全地存储客户端密钥,因为它们的整个源代码都可以在浏览器中访问

这两种情况都不适用于本场景;Discourse 服务器持有密钥。

Animated GIF