Laravel Passport Trying to get property ‘secret’ of non-object

THIS IS FOR LARAVEL 8 AND LARAVEL/PASSPORT

The first thing is to run the php artisan passport:install.

Inside your database table oauth_clients, under column name, look for Laravel Personal Access Client.

Copy the secret beside Laravel Personal Access Client.

Open AuthServiceProvider, then paste the secret inside the boot method where the CLIENT_SECRET is below:

Passport::personalAccessClientSecret(config('CLIENT_SECRET'));

And don’t forget to also add the ID of the secret from your database.

Passport::personalAccessClientId(config('ID'));

Use the quote along with the ID and CLIENT_SECRET as config() is expected to get a string.

Now is solved this error

Tagged : / /

HOW TO CREATE API IN LARAVEL

1st step:- open command prompt and go to xampp\htdocs folder and write the code given below in command prompt to create the project

Composer create-project –prefer-dist laravel/laravel admin “5.5.*”

2nd step:-now go to the project folder and make auth. Code is given below

               php artisan make:auth

3rd step:- Now install the passport. Write the code given below in command prompt.

    Composer required laravel/passport

4th step:-open phpmyadmin and make a database.

5th step:- open .env file and configure the database.

6th step:- Now migrate the database. Write the code given below in the command prompt

     php artisan migrate

7th step:-Add the code given below in user model.

       use Laravel\Passport\HasApiTokens;

8th step:- Add the code given below in auth service proviser(C:\xampp\htdocs\ admin\Providers\AuthorServiceProvider.php)

      use Laravel\Passport\Passport;

9th step:- Now configure auth.php(C:\xampp\htdocs\admin\config\auth.php)

Change the driver and provider as given below in api:-

‘api’=>[

‘driver’=>’passport’,

‘provider’=>’users’

],

10th step:- Add the code given below in kernel.php. (C:\xampp\htdocs\ admin\app\Http\Kernal.php)

Protected $routeMiddleware=[

‘client’_credentials’=>\Laravel\Passport\Http\Middleware\CheckClientcredentials::class,

11th step:-Add the code given below in app.php(config\app.php)

/*

   *Application Service Providers…

  */

 //Passport Service provider

    Laravel\Passport\PassportServiceprovider::class,

];

12th step:- Write the code given below in command prompt.

              php artisan passport:install

      Encryption keys generated successfully.

Tagged : / /