mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #1783 from williamjoy/master
oauth google: read api_url from config file
This commit is contained in:
commit
c54f0fe58b
@ -79,7 +79,7 @@ func NewOAuthService() {
|
|||||||
// Google.
|
// Google.
|
||||||
if name == "google" {
|
if name == "google" {
|
||||||
setting.OAuthService.Google = true
|
setting.OAuthService.Google = true
|
||||||
SocialMap["google"] = &SocialGoogle{Config: &config, allowedDomains: info.AllowedDomains}
|
SocialMap["google"] = &SocialGoogle{Config: &config, allowedDomains: info.AllowedDomains, ApiUrl: info.ApiUrl}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,6 +149,7 @@ func (s *SocialGithub) UserInfo(token *oauth2.Token) (*BasicUserInfo, error) {
|
|||||||
type SocialGoogle struct {
|
type SocialGoogle struct {
|
||||||
*oauth2.Config
|
*oauth2.Config
|
||||||
allowedDomains []string
|
allowedDomains []string
|
||||||
|
ApiUrl string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SocialGoogle) Type() int {
|
func (s *SocialGoogle) Type() int {
|
||||||
@ -167,9 +168,8 @@ func (s *SocialGoogle) UserInfo(token *oauth2.Token) (*BasicUserInfo, error) {
|
|||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
reqUrl := "https://www.googleapis.com/oauth2/v1/userinfo"
|
|
||||||
client := s.Client(oauth2.NoContext, token)
|
client := s.Client(oauth2.NoContext, token)
|
||||||
r, err := client.Get(reqUrl)
|
r, err := client.Get(s.ApiUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user