donglong1465
2017-09-27 10:34
浏览 120
已采纳

具有Userfrosting的RESTful API

I'm using UserFrosting to manage users with PHP, in my API and I want to use the login function in controller with POST method.

When i call the login function it return me as response

The CSRF code was invalid or not provided.

I still cannot get the csrf_token

Any idea?

图片转代码服务由CSDN问答提供 功能建议

我正在使用UserFrosting在 API中使用 PHP 管理用户 我希望在POST方法中使用控制器中的登录功能。

当我调用登录功能时,它会将我作为响应返回

CSRF代码无效或未提供。

我仍然无法获得 csrf_token \ n

有什么想法吗?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dsa456369 2017-09-28 15:41
    已采纳

    There is a UserFrosting Sprinkle that implements JWT authentication: https://github.com/x00x70/tokeniser

    Join us in chat if you have any questions about its use!

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • dongpu4141 2017-09-27 13:06

    If you're developing an API (either for it to be consumed by an webplatform or mobile app) I belive it's better to have a different kind of authentication, namely, JWT authentication. In Laravel you have Passport to handle this Authentication with ease. I'm not sure how userFroasting uses laravel but if laravel version is above 5.3 you can use it.

    If it isn't there's always the option of making a costum JWT authentication.

    Here is the latest documentation for Passport https://laravel.com/docs/5.5/passport.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题