joselfonseca / lighthouse-graphql-passport-auth

Add GraphQL mutations to get tokens from passport for https://lighthouse-php.com/
https://lighthouse-php-auth.com/
MIT License
228 stars 56 forks source link

Invalid client after php artisan migrate:fresh #152

Closed Parables closed 2 years ago

Parables commented 2 years ago

Fresh laravel installation. follow the tutorial and everything works as expected.

Then instead of creating a new migration, I make changes to the user model by adding in some fields like phone_numberh

Then I run php artisan migrate:fresh, and php artisan passport:install --force` , create my test user and ned up in this

{
  "errors": [
    {
      "message": "invalid_client",
      "extensions": {
        "reason": "Client authentication failed",
        "category": "authentication"
      },
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "login"
      ],
...

But when I go into the config file and manually replace these everything works as expected

    'client_id' => env('PASSPORT_CLIENT_ID', '2'),
    'client_secret' => env('PASSPORT_CLIENT_SECRET', 'SECRET_FROM_MYDB'),
catabozan commented 2 years ago

Try clearing the config cache using php artisan config:clear and then rebuilding the cache using php artisan config:cache

Then, you should be able to get the correct values from the .env file.

Parables commented 2 years ago

Thanks very much for your help