Creating a server provider

The following code outlines the contents of the gmail.go file that's available in the client package of the repository for this book. If you want to jump straight to trying out this functionality, then simply copy your credentials.json file to the current directory and skip to the next section, Update an example to use Gmail.

We start by adding the necessary OAuth2 setup and token storage by copying the getClient(), getTokenFromWeb(), tokenFromFile(), and saveToken() functions from Google's Gmail quickstart Go file at github.com/gsuitedevs/go-samples/blob/master/gmail/quickstart/quickstart.go. These are very similar to the OAuth2 code that was created before but works better with the Google libraries.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.221.133