Execute composer require laravel/passport
Execute php artisan migrate
Execute php artisan passport:install
Execute composer require laravel/breeze --dev
Execute php artisan breeze:install
Replace HasApiToken in Users with Sanctum/HasApiToken
Add api in auth array in the guard.php file
Execute php artisan passport:client
generate the client id, client name, callback, client secret
create an user through localhost:8000/register
Open Postman:
First Authorize user by sending a GET request, below image provided for reference:
Take the full url and search using the browser
Login then click Authorize
Now 404 not found page will be shown along with the code and state in url bar
Copy the code
Next process is to Generate the Bearer/Access token for accessing API's, take the below image for reference
Lastly for testing an API, the below example's been given:
Lastly, Passport's OAuth default routes:
Top comments (0)