簡體   English   中英

Javascript應用程序中OAuth 2身份驗證的最佳安全做法

[英]Best security practices for OAuth 2 authentication in a Javascript application

我有一個REST API,具有OAuth 2身份驗證機制(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] : 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)。

在您所描述的上下文中,最好的選擇(如果無法更改api)是創建一個瘦代理以向令牌添加另一層保護。

假設您可能是JavaScript開發人員,則可以輕松使用AWS API Gateway + Lambda來創建它,而無需服務器。

每當有人在單個頁面上通過Web應用程序實現OAuth時,服務器就會死亡。 停止種族滅絕! 使用服務器端代理! 現在就采取行動!

-Alex Bilbie(@alexbilbie)( https://github.com/alexbilbie/alexbilbie.github.com/blob/master/_posts/2014-11-11-oauth-and-javascript.md

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM