Generic OAuth with Auth0

Hey there,

I am trying to set up OAuth with Auth0 following the docs and the discussion at https://localhost:3000/t/auth0-authentication-support/4875/ however I am getting the following error:

login.OAuthLogin(NewTransportWithCode) logger=context userId=0 orgId=0 uname= error=“oauth2: cannot fetch token: 400 Bad Request\nResponse: {“error”:“invalid_request”,“error_description”:“missing access_token parameter”}”

I am using the latest stable version of Grafana (5.0.0).

Any help would be appreciated.

Thanks
Dimitris

Hey,

Have you checked the documentation?

Marcus

Yeah as mentioned I followed the docs at Configure Grafana | Grafana documentation and the respective thread posted above.

My config looks like this:

[server]
root_url = ROOT_URL
[auth.generic_oauth]
enabled = true
allow_sign_up = true
team_ids =
allowed_organizations =
name = Auth0
client_id = AUTH0_CLIENT_ID
client_secret = AUTH0_CLIENT_SECRET
scopes = openid profile email
auth_url = AUTH0_DOMAIN/authorize
token_url = AUTH0_DOMAIN/oauth/access_token
api_url = AUTH0_DOMAIN/userinfo

The error occurs after I successfully authenticate with auth0 and then I get redirected back to our Grafana setup. The request is the following:

https://ourdomain/login/generic_oauth?code=CODE&state=STATE
Cookie: grafana_sess=GRAFANA_SESS

The response is a 500 with the and the logs are mentioned in my original message.

Thanks
Dimitris

1 Like

Hi,

Have you configured your callback url correctly?

Marcus

Hey

Given that the call returns back to grafana, after I authenticate with Auth0, I assume it is. It looks like this ROOT_URL/login/generic_oauth, where ROOT_URL the full URL as set in the server section of the settings (eg.: ROOT_URL=https://example.com/ and in Auth0 callback_url: https://example.com/login/generic_oauth).

Could the error missing access_token parameter be a pointer for something particular?

Cheers
Dimitris

Error are coming from oauth2 library where using. https://github.com/golang/oauth2/search?utf8=✓&q=cannot+fetch+token&type=

But seems to me that it is auth0 that returns a response with 400 Bad Request\nResponse: {“error”:“invalid_request”,“error_description”:“missing access_token parameter”}”

Marcus