OAuth2 Implementation - RESTful API with Laravel - 11

preview_player
Показать описание
You will learn to create restful API with Passport authentication in laravel. We will create rest API with passport installation and implementation for authentication from scratch so you can easily understand and use it with your application.

In today's, laravel become more famous PHP framework. almost are prefer laravel for creating API for back-end framework because laravel is the best framework. Laravel provides several features like security, rest API, middleware, passport, events, models, routing etc. it is very easy to use and make it clean code with laravel.

But first please watch these videos first
What is oauth2?

Passport setup:

Remember!
Anybody can learn programming no matter who you are. You just need some time to study.

The most starred PHP framework, Laravel. My goal with this Laravel tutorial to create a guide for those learning the framework. This guide will take you from the very beginning of an idea into a real deployable application.

Laravel api Tutorial
Laravel rest api Tutorial
Laravel api Tutorial for Beginners Step by Step

Laravel Tutorial Series Playlist:

Laravel api Tutorial for Beginners Step by Step Playlist

Laravel Tutorial for Beginners Step by Step Playlist

#LaravelTutorial #LaravelHindi #LaravelTutorialSeries #AtifNaseem #Laravel
Рекомендации по теме
Комментарии
Автор

got the same had to make some changes

you need to add the CheckClientCredentials middleware to the $routeMiddleware property of your app/Http/Kernel.php file:


use


protected $routeMiddleware = [
'client' => CheckClientCredentials::class,
];


Then, attach the middleware to a route by changing:


Route::group(['middleware' => 'auth:api'], function () {
Route::apiResource('country',
});


TO:



Route::apiResource('country',


using the "bearer token" authorization in POSTMAN, input your token and it should work...
IT WORKED FOR ME!!

georgeedomwande
Автор

I am using laravel 6.2 and with the help of Atif sir and Edomwande bro, I successfully overcome this problem.
Those who can't get success, I wanna tell you that please revise your code. Thank you.

cherisheddream
Автор

It is really a great tutorial. Thanks Atif bhae.

Ironateeb
Автор

I tried to do the fix from the comments but nothing works. I am on Laravel 6.14.
error:

Target class [routeMiddleware] does not exists.

markbriones
Автор

Excellent 'Atif Naseem' U Just Save My Time. Thanks From Bangladesh....

priyaakter
Автор

6:18
{"error":"invalid_client", "message":"Client authentication failed"}
Followed George Edomwande but still the same :(

longphamtien
Автор

please help me sir on 7.39 i got error "message": "Unauthenticated." i use laravel 7

SorrowBee_
Автор

I am using laravel 7.5 and I don't get the login page in postman 2:04

java
Автор

can you help me with a question? if i connect to an api to consult a list of products but the user does not need to be logged in, do i need authentication?

nataliagonzalez
Автор

why you are not selected auth 2.0 in authorization tab ?

idiotgamer
Автор

Could you please suggest a link about how to use these API's authentication methods out of POSTMAN application box, I can't imagine a way to type these headers, body, authorization... which POSTMAN offers in an android application for example

mhmmdabrs
Автор

Sir, How we access through JWT, I want to use JWT instead of Passport

nitishpathak
Автор

I have a problem in this lessons the time is 8.17 seconds. when I a send a api request for country by postman with accept and authorization

learnwithshahriar-bd
Автор

me too i did all what you said and it still message unauthenticated

smartytec
Автор

is it an auth2 implementation or auth 1?

idiotgamer
Автор

as #George commented before, but i edited some strings to be sure its the same as video.

Go to App/http/Kernel.php

add this line
use

then in $routeMiddleware function
add this line
'client' => CheckClientCredentials::class,

after that change this
Route::group(['middleware' => 'auth:api'], function () {


Route::apiResource('country', 'Country\Country');
});

To this


Route::group(['middleware' => 'client'], function () {
Route::apiResource('country', 'Country\Country');
});

MotasemZindaqy
Автор

I am got "message": "Unauthenticated." Did I something wrong??

陳建至-rx
Автор

What about refresh tokens? How does it work?

williampecoraro
Автор

Can you explain me why should I use clients?

akimmigon
Автор

{
"error": "invalid_client",
"error_description": "Client authentication failed",
"message": "Client authentication failed"
}

geting that error .

jaytona
visit shbcf.ru