Hi, I’m trying to set up Grafana to use a Drupal site as the OAuth server.
- Go to my Grafana url
- Click on “Sign in with OAuth”
- It redirects me to the Drupal site.
- I log in on the Drupal site.
- I authorize the app if was not previously authorized.
- It redirects to my grafana url
- Grafana shows error: “login.OAuthLogin(get info from generic_oauth)”
Error I can see on the grafana log:
t=2020-01-16T15:54:26-0500 lvl=eror msg="login.OAuthLogin(get info from generic_oauth)" logger=context userId=0 orgId=0 uname= error="Error decoding user info JSON: json: cannot unmarshal array into Go value of type social.UserInfoJson"
[auth.generic_oauth] enabled = true name = OAuth allow_sign_up = false scopes = gestor client_id = [CLIENT_ID] client_secret = [CLIENT_SECRET] auth_url = https://example.com/oauth/authorize token_url = https://example.com/oauth/token api_url = https://example.com/api/me email_attribute_path = .mail role_attribute_path = contains(.roles_target_id, 'Gestor') && 'Admin' || contains(.roles_target_id, 'Cliente') && 'Viewer'
The https://example.com/api/me I’ve cofigured in the Drupal site is a REST api point that prints the current user information (I’ve checked the JMESPath and seems to be ok):
I do appreciate any guidance on how to troubleshoot this kind of error, I guess I’m missing some configuration somewhere.
Is maybe because the REST response is an array?
Thanks in advance !
PS: I made sure to have my grafana admin user and Drupal user with the same email.
Update: I’ve modified my Drupal response so it’s easier (less fields).