In Chapter 12, Concurrency, Networking, and Cloud Services, we wrote the OAuth2 handlers and Gmail integration using only the standard library. For this final code exploration, we'll use the helpful library that Google has created for interacting with Gmail servers. To use this library, we need the client credentials in a different format (credentials.json). To access this, log in to your Google account and go to the Go quickstart page at https://developers.google.com/gmail/api/quickstart/go. Once here, you'll need to click on ENABLE THE GMAIL API and then DOWNLOAD CLIENT CONFIGURATION. This will download the credentials.json file that we'll need to initialize the library in the next section, Creating server provider.
Once you've downloaded the credentials file, you'll need to install the two required...