2016-12-31 80 views
0

我想讓wordpress作爲我的angularjs應用程序的後端,所以我使用jwt-auth 的插件rest-api,所以當試圖登錄時我得到以下錯誤Angular with wordpress jwt驗證碼

XMLHttpRequest cannot load http://localhost/back/wp-json/jwt-auth/v1/token. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://imider.ma' is therefore not allowed access. The response had HTTP status code 500. 

我知道我要補充CROS訪問,但我不熟悉WordPress的,所以任何幫助?

回答

0

我創建了一個視頻,詳細介紹了安裝和設置過程插入。如果你遵循我在那裏概述的步驟,你應該很好。

https://youtu.be/Mp7T7x1oxDk

的想法是,你還需要修改.htaccesswp-config.php,以與現有的API端點插件工作爲好。

只需安裝插件並添加SECRET_KEY(用於對令牌進行簽名即可使JWT設置正常工作,但不允許將通過該API生成的令牌與現有REST API端點一起使用。