Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[oauth] Error using tokens outside the UserInfoJson struct format #36340

Open
stg-0 opened this issue Jul 1, 2021 · 2 comments
Open

[oauth] Error using tokens outside the UserInfoJson struct format #36340

stg-0 opened this issue Jul 1, 2021 · 2 comments

Comments

@stg-0
Copy link

stg-0 commented Jul 1, 2021

What happened:

When the oauth flow returns a profile with an attributes field type that don't match the expected one, Grafana returns the error "Error decoding user info response".

What you expected to happen:

As I've defined the email_attribute_path in the config, I expect Grafana gets it from there without trying to match it with a specific structure, but it seems that never reaches that part of the code.

How to reproduce it (as minimally and precisely as possible):

Using an oauth profile with an attributes field that don't match the expected type: map[string][]string.

For example:
{ "id": "test", "attributes": [ { "roles": [ "roleA", "roleB" ] }, { "mail": "test@example.com" } ] }

One would expect that adding this in the defaults.ini file, things will go ok:
email_attribute_path = (attributes[].mail)[0]

Anything else we need to know?:

I've created this PR that seems to solve my use-case: #35985

Environment:

  • Grafana version:
  • Data source type & version:
  • OS Grafana is installed on:
  • User OS & Browser:
  • Grafana plugins:
  • Others:
@dsotirakis dsotirakis added the needs more info Issue needs more information, like query results, dashboard or panel json, grafana version etc label Jul 2, 2021
@dsotirakis dsotirakis added this to Inbox in Backend Platform Backlog via automation Jul 2, 2021
@marefr marefr added area/auth/oauth type/bug and removed needs more info Issue needs more information, like query results, dashboard or panel json, grafana version etc labels Jul 8, 2021
@marefr
Copy link
Member

marefr commented Jul 8, 2021

As a potential workaround, try to use a different property than attributes and it should work as expected.

@Jguer
Copy link
Contributor

Jguer commented Dec 28, 2023

@vtorosyan this might interest you in your JMESPath expansion work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants