Before we can begin, we’ll need to create an application in the Google API Console in order to get a client ID and client secret, and register the redirect URL.
Visit https://console.developers.google.com/ and create a new project. You’ll also need to create OAuth 2.0 credentials for the project since Google does not do that automatically. From the sidebar, click the Credentials tab, then click Create credentials and choose OAuth client ID from the dropdown.
The Google Console will prompt for some information about your application such as the product name, a home page, and a logo. On the next page, select Web application type, and enter the redirect URL where the script we’ll build next will live. You will then receive a client ID and secret.