mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Auth: Log a more useful msg if no OAuth provider configured (#56722)
Log a useful msg if no oauth provider configured When a user doesn't configure an OAuth provider and uses auto login, Grafana logs a misleading message indicating that he has multiple providers configured.
This commit is contained in:
parent
ba6d2f2a82
commit
707198227c
@ -142,9 +142,12 @@ func (hs *HTTPServer) tryOAuthAutoLogin(c *models.ReqContext) bool {
|
||||
return false
|
||||
}
|
||||
oauthInfos := hs.SocialService.GetOAuthInfoProviders()
|
||||
if len(oauthInfos) != 1 {
|
||||
if len(oauthInfos) > 1 {
|
||||
c.Logger.Warn("Skipping OAuth auto login because multiple OAuth providers are configured")
|
||||
return false
|
||||
} else if len(oauthInfos) == 0 {
|
||||
c.Logger.Warn("Skipping OAuth auto login because no OAuth providers are configured")
|
||||
return false
|
||||
}
|
||||
for key := range oauthInfos {
|
||||
redirectUrl := hs.Cfg.AppSubURL + "/login/" + key
|
||||
|
Loading…
Reference in New Issue
Block a user