M. Hanafi
M. Hanafi

Reputation: 66

RESTful API with Userfrosting

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?

Upvotes: 1

Views: 711

Answers (2)

alexw
alexw

Reputation: 8688

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!

Upvotes: 0

Sérgio Reis
Sérgio Reis

Reputation: 2523

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.

Upvotes: 0

Related Questions