Testing the Gmail API using OAuth2
This applies what we have learnt about OAuth 2 authentication to the Google Gmail API, and in doing so shows how to use scopes to grant authorization. It also indirectly builds on the Testing for e-mails with Groovy recipe Chapter 4, Web Service Test Scenarios, by providing a secure way of authenticating that was a reported Google issue when using IMAP to access a Gmail account.
To perform the steps of this recipe, you will need a Google account with a developer console and a Gmail account.
Getting ready
If you haven't already got a Google account set up, please register for one at https://accounts.google.com/Signup. This also gets you a Gmail account.
You will also need access to the Developers console to create new projects, enable APIs, and create OAuth 2 credentials. For all information about Developer accounts, see https://developers.google.com/console/help/new/. It should be completely free when used in the context of this recipe, that is, Gmail API access...