Server side error OAuthLogin

Hi,
I am trying to setup google Google QAuth and getting the above error.
Grafana version: 4.6.3 (docker)
OS: ubuntu 16.04
indent preformatted text by 4 spaces
Configuration:
##Google Client ID for Web application##
Authorized JavaScript origins = http://my.website.com
Authorized redirect URIs = http://my.website.com:3000/login/google

##Grafana.ini##
[server]
protocol = http
http_port = 3000
domain = my.website.com:3000
enforce_domain = false
root_url = http://my.website.com:3000
router_logging = false
static_root_path = public

[auth.google]
enabled = true
allow_sign_up = false
client_id = secret
client_secret = secret
scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
auth_url = https://accounts.google.com/o/oauth2/auth
token_url = "https://www.googleapis.com/o/oauth2/token"
api_url = "https://www.googleapis.com/oauth2/v1/userinfo"
allowed_domains = my.website.com



log:

t=2018-02-06T22:01:37+0000 lvl=info msg="Initializing HTTP Server" logger=http.server address=0.0.0.0:3000 protocol=http subUrl= socket=
t=2018-02-06T22:01:44+0000 lvl=info msg="Request Completed" logger=context userId=0 orgId=0 uname= method=GET path=/login/google status=302 remote_addr=46.555.133.83 time_ms=0 size=458 referer=http://my.website.com:3000/login
t=2018-02-06T22:01:48+0000 lvl=eror msg=login.OAuthLogin(NewTransportWithCode) logger=context userId=0 orgId=0 uname= error="oauth2: cannot fetch token: 404 Not Found\nResponse: Not Found"
t=2018-02-06T22:01:48+0000 lvl=eror msg="Request Completed" logger=context userId=0 orgId=0 uname= method=GET path=/login/google status=500 remote_addr=46.555.133.83 time_ms=67 size=1140 referer=
    indent preformatted text by 4 spaces
1 Like

I wonder if it is because of the double quotes around the token url (and the API url). The 404 error seems to be for the token url.

Hi,
Issue is related to Grafana running as a container. When installing it manually it worked as expected. Do you know any specific parameters that are required when running it as a container?

I suppose if the same settings work on a local Grafana then it is not a typo somewhere.

  • Does your container have access to googleapis.com from your container?

  • Is the root_url correct?

This is the full URL used to access Grafana from a web browser. This is important if you use Google or GitHub OAuth authentication (for the callback URL to be correct).

I just verified.

  • The container has access to googleapis.com

  • The root_url is the DNS name and when I ping the DNS it from the host or from the container I get the same IP.

This error is from Google oauth and not from Grafana. Can you turn on debug logging in the ini file so that we can see the debug logging for Grafana oauth:

[log]
level = debug