【问题标题】:Best security practices for OAuth 2 authentication in a Javascript applicationJavascript 应用程序中 OAuth 2 身份验证的最佳安全实践
【发布时间】:2017-03-27 21:21:51
【问题描述】:

我有一个带有 OAuth 2 身份验证机制的 REST API(Symfony 3 应用程序上的 FOSOAuthServerBundle)。

要获取/刷新令牌,URL 类似于:https://api.example.com/oauth/v2/token?grant_type=[password|refresh_token]&client_id=[client_id]&client_secret=[client_secret]&username=[username]&password=[password]

这在服务器到服务器调用上效果很好,但不能应用于 Javascript 应用程序。

如何从前端应用程序实现 API Oauth 2 身份验证? (JWT 不存在于服务器上)。

【问题讨论】:

    标签: javascript symfony oauth fosoauthserverbundle


    【解决方案1】:

    在您描述的上下文中,最好的选择(如果无法更改 api)是创建一个精简代理以向您的令牌添加另一层保护。

    鉴于您可能是 javascript 开发人员,您可以轻松使用 AWS API Gateway + Lambda 来创建它,而无需服务器。

    每当有人在单个页面中实现 OAuth 时,服务器就会死掉 网络应用程序。停止种族灭绝!使用服务器端代理!立即行动!

    ——亚历克斯·比尔比 (@alexbilbie) (https://github.com/alexbilbie/alexbilbie.github.com/blob/master/_posts/2014-11-11-oauth-and-javascript.md)

    【讨论】:

      猜你喜欢
      • 2014-04-11
      • 2017-03-05
      • 2015-02-24
      • 2012-03-26
      • 2014-01-23
      • 2013-01-17
      • 2014-06-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多