Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel RESTful API authentication for mobile app

I would like to discuss what is the best way to secure your API's in order to be used from a mobile application.

Since there is not third-party I guess OAuth is not a good choice?
Would JWT be a good choice?

The hard part for me to understand is how can I authenticate so I can protect the data in my API's unless someone is authorized to call them.

I use Laravel 5.1 in server side and the mobile application that I want to call the API's is an android one.

I hope that I didn't forget to mention any important information. Any kind of help will be appreciated.

like image 404
csdinos Avatar asked Jun 21 '16 09:06

csdinos


1 Answers

Use OAuth2

Consider using OAuth 2 with Client Credentials Grant.

You can request an access token using your Client's credentials.

  • Client Credentials Grant

Use OAuth 2 Server Laravel:

  • lucadegasperi/oauth2-server-laravel

Implementing an Authorization Server with the Client Credentials Grant using Luca's package:

  • Implementing Client Credentials Grant
like image 197
Álvaro Guimarães Avatar answered Oct 13 '22 01:10

Álvaro Guimarães