Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Authentication in Laravel with react front end

I can't find an exact answer to this on Google. I created a Simple Blog Application in Laravel. and used react for front-end and back-end. For crud operation i use resource and api routes.

This is My api.php

<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
 */

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::resource('blog', 'BlogController');

For back-end and front-end same route is used. Now i want to add Authentication for back-end (Admin) and stucked at what to use for authnetication :

I have two options:

I don't understand when to use Token Based Auth or built in auth. In future mobile app is also used for add blog. help me.

Comments