Search code examples
laravellaravel-socialite

Laravel Socialite Github OAuth Response 401 Bad Credentials


I am working on Laravel 7 and for social login I am using Socialite package. I am following this article for reference and did exactly the same but I am getting an unauthorized response with a message - "Bad Credentials". I have also tried resetting the secret key.

This is my Github settings

Thanks for the response.


Solution

  • Aside from making sure that your client_id and client_secret are set correctly, you also need to ensure that your redirect value in your config/services.php:

    'github' => [
      'client_id' => env('GITHUB_CLIENT_ID'),
      'client_secret' => env('GITHUB_CLIENT_SECRET'),
      'redirect' => 'http://yourapp.test/login/github/callback'
    ],
    

    Is identical to what you set under your Github app: enter image description here