Search code examples
javascriptgoogle-cloud-platformnext.jsoauth-2.0

How to generate GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET without a domain?


I would like to create a new Google API project for a nextJS webapp. I cannot understand how to get the API GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET without a domain.

I have to setup in the .env file

# Next Auth Google provider
GOOGLE_CLIENT_ID="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
GOOGLE_CLIENT_SECRET="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

I tried looking for solutions but I cannot find the resources.Screenshot showing the options


Solution

  • I realized that the field is optional and can be changed later in the console. Try to put in something to avoid the validation error and use the following resource to update the authorized origin to localhost.

    https://nextjstemplates.com/docs/authentication/google-login

    This is what worked for localhost.

    enter image description here