![]() ![]() 'client_secret' => env('GOOGLE_CLIENT_SECRET'), We need to add this inside of the returned array. Now, go to app/services.php to add the configs for Google for Socialite. 'Socialite' => Laravel\Socialite\Facades\Socialite::class, Laravel\Socialite\SocialiteServiceProvider::class,Īlso, in the same file add the alias in the alias array. Go to config/app.php and look into the array for the providers entry, you need to add a new item inside of the providers array for Socialite. Next step is to add the socialite service to Laravel. Next, install the socialite package into your laravel project using composer, run composer require laravel/socialiteĭone, the library is added. You might need to set the Oauth consent screen first, this is data for the google oauth form, fill the data and continue. You might need to create a project in Google Cloud Platform first, follow the step by step form. ![]() We will set this callback in the socialite configuration later.Īfter that you’ll get the Client ID and Secret from google that we will be using to configure socialite. However, if you have another environment, dev for example, the domain can be , you can add /auth/callback here too. To be more clear, let’s assume that the production domain of your app is, our callback route will be /auth/callback, so you need to add /auth/callback. The most important part here is the Authorized redirect Uris, Here you can put all the urls that you will be using to redirect the user after the success login in google to your app, is a list of valid urls that can be used in the app. Authorized redirect Uris: The url for go back to your app > after the google login.Google API Keysįirst, we will need to enable Credentials for OAuth 2.0 on the Google Developer Console.įrom there, Go to API & Services -> Credentials -> Create Credentials -> OAuth Client IDĪ form will be prompted to create the credentials, fill the form with this info. I’m assuming that you already have a Laravel 8 project installed and running. In this post we’re going to add authentication via Google to a Laravel app. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |