OAuth2 is a relatively common protocol for speaking with APIs. The golang.org/x/oauth2 package provides a pretty flexible client for working with OAuth2. It has subpackages that specify endpoints for various providers such as Facebook, Google, and GitHub.
This recipe will demonstrate how to create a new GitHub OAuth2 client and some of its basic usage.