how to authenticate RESTful API in Laravel 5?

后端 未结 2 562
生来不讨喜
生来不讨喜 2021-01-07 17:49

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

相关标签:
2条回答
  • 2021-01-07 18:35

    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:pass@yourapp.com/yourresource/1
    
    0 讨论(0)
  • 2021-01-07 18:37

    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.

    0 讨论(0)
提交回复
热议问题