How to integrate google sign-in?

Last update: 17/Apr/2022

First of all, Goto Google developer console and create a project.

https://console.developers.google.com/projectcreate

After creation of project. make sure that you've selected the created project. Goto credentials page https://console.developers.google.com/apis/credentials Click on the create credentials and select OAuth Client ID > Consent > Web Application

Now, you will get client id and client secret.

Login to your cpanel or any control panel and goto file manager. PROJECT-ROOT/.env you can find the .env file. Open the file and update the values like,

GOOGLE_ENABLE=on
GOOGLE_CLIENT_ID=000000000000-XXXXXXXXXXX.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=XXXXXXXXXXXXX
GOOGLE_REDIRECT=https://YOUR-DOMAIN.com/sign-in-with-google

Finally, add your domain URL in the Authorised redirect URIs box on the google credentials page. Also it must be end with /sign-in-with-google

Eg. https://YOUR-DOMAIN.com/sign-in-with-google