laravel_sanctum

https://www.twilio.com/blog/build-restful-api-php-laravel-sanctum

  • Route
Route::post('/me', [AuthController::class, 'me']);

Route::post('/me', [AuthController::class, 'me'])->middleware('auth:sanctum');

Route::group(['middleware' => ['auth:sanctum']], function () {
    Route::post('/me', [AuthController::class, 'me']);
});
{
    "name" : "gzeinnumer",
    "email" : "gzeinnumer@gmail.com",
    "password" : "12345678"
}

Response

{
    "access_token": "7|HrfTY2yMca5KpcPiBVoFhyI60fluQa6bnW5Jq9WY",
    "token_type": "Bearer"
}

Request

{
    "email" : "gzeinnumer@gmail.com",
    "password" : "12345678"
}

Response

{
    "access_token": "8|qSMFPYLLbHVy7gwB8nwVXwyxyAy8qcfEYPqPlVKA",
    "token_type": "Bearer"
}


Copyright 2022 M. Fadli Zein