Vaibhav
Vaibhav

Reputation: 335

how to authenticate RESTful API in Laravel 5?

How to authenticate RESTful API in Laravel 5? I am using Laravel 5 to build a RESTful API & I want to use those API for mobile application.

I have also seen http://laravel.com/docs/5.0/authentication but not getting any related example so,please provide me sample example or appropriate link for authenticate RESTful API in Laravel 5.

Upvotes: 23

Views: 25347

Answers (2)

Tarunn
Tarunn

Reputation: 1048

I was looking for the same answer and I found this link very useful with detailed information and usage for L5 with the use of JWT .

JSON Web Token

Hope it helps you too.

Upvotes: 17

nozzleman
nozzleman

Reputation: 9669

The Concept to use here would be Middleware: To get you started, put this in your API-Controller's ctors:

public function __construct()
{
    // reqires Authentificataion before access
    $this->middleware('auth.basic');
}

Your app should then be able to call the resources like

http://user:[email protected]/yourresource/1

Upvotes: 5

Related Questions