How to authenticate user with Fuelphp REST?

685 views Asked by At

I am new to Fuel PHP... I am working on a project with REST architecture in Fuelphp..... I didn't found any tutorial how to achieve the required functionality "User Authentication using Fuel PHP REST".

As REST server is stateless how do we use auth package of fuelphp in rest api?

2

There are 2 answers

0
mark.sagikazar On

As you also pointed, REST calls are somewhat stateless meaning you have no session to store.

The auth documentation has some methods which checks user credentials, but does not store authentication. There are no offical way of doing this.

3
Emlyn On

One of the methods that I have used in the past is to use a token based system. You have an API token linked to an Auth user then this token is supplied in the Authorize header when making a request, the token is then checked against known tokens and if valid a forced login is performed with the Auth package.