This guide will help you set up a Google API project that will be compatible with Nylas, but doesn’t cover how to get a refresh token. To see example code of how to retrieve a refresh token from Google, check out the example project here. To learn more about general OAuth setup, follow Google’s guide.
Visit the Google Developer Console and select Create Project. Give your project a descriptive name, click Create and wait for the activity to complete.
Once the project has been created, you must enable all of the following APIs by searching for their names:
- Gmail API
- Contacts API
- Calendar API
After you’ve enabled the appropriate APIs, click on the credentials tab and create a new OAuth client ID.
Next you need to configure the consent screen. This is where you can add your logo and change how the OAuth page will look to your users. Be sure to add appropriate redirect and origin URIs. This is how you’ll receive the access and refresh tokens from Google.