Package github implements the OAuth2 protocol for authenticating users through Github. This package can be used as a reference implementation of an OAuth2 provider for Goth.
var ( AuthURL = "https://github.com/login/oauth/authorize" TokenURL = "https://github.com/login/oauth/access_token" ProfileURL = "https://api.github.com/user" EmailURL = "https://api.github.com/user/emails" )
These vars define the Authentication, Token, and API URLS for GitHub. If using GitHub enterprise you should change these values before calling New.
github.AuthURL = "https://github.acme.com/login/oauth/authorize github.TokenURL = "https://github.acme.com/login/oauth/access_token github.ProfileURL = "https://github.acme.com/api/v3/user github.EmailURL = "https://github.acme.com/api/v3/user/emails
Provider is the implementation of `goth.Provider` for accessing Github.
New creates a new Github provider, and sets up important connection details. You should always call `github.New` to get a new Provider. Never try to create one manually.
NewCustomisedURL is similar to New(...) but can be used to set custom URLs to connect to
BeginAuth asks Github for an authentication end-point.
Debug is a no-op for the github package.
FetchUser will go to Github and access basic information about the user.
Name is the name used to retrieve this provider later.
RefreshToken refresh token is not provided by github
RefreshTokenAvailable refresh token is not provided by github
SetName is to update the name of the provider (needed in case of multiple providers of 1 type)
UnmarshalSession will unmarshal a JSON string into a session.
Session stores data during the auth process with Github.
Authorize the session with Github and return the access token to be stored for future use.
GetAuthURL will return the URL set by calling the `BeginAuth` function on the Github provider.
Marshal the session into a string