Put values from settings into handler/auth.go

This commit is contained in:
Vsevolod Strukchinsky 2014-02-09 19:39:25 +06:00
parent 7208d95a76
commit 6c9ff00f99

View file

@ -48,8 +48,8 @@ func LinkGithub(w http.ResponseWriter, r *http.Request, u *User) error {
// github OAuth2 Data // github OAuth2 Data
var oauth = oauth2.Client{ var oauth = oauth2.Client{
RedirectURL: settings.URL().String() + "/auth/login/github", RedirectURL: settings.URL().String() + "/auth/login/github",
AccessTokenURL: "https://github.com/login/oauth/access_token", AccessTokenURL: "https://" + settings.GitHubDomain + "/login/oauth/access_token",
AuthorizationURL: "https://github.com/login/oauth/authorize", AuthorizationURL: "https://" + settings.GitHubDomain + "/login/oauth/authorize",
ClientId: settings.GitHubKey, ClientId: settings.GitHubKey,
ClientSecret: settings.GitHubSecret, ClientSecret: settings.GitHubSecret,
} }
@ -72,6 +72,7 @@ func LinkGithub(w http.ResponseWriter, r *http.Request, u *User) error {
// create the client // create the client
client := github.New(token.AccessToken) client := github.New(token.AccessToken)
client.ApiUrl = settings.GitHubApiUrl
// get the user information // get the user information
githubUser, err := client.Users.Current() githubUser, err := client.Users.Current()