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

Auth: Cannot add newly signed up (via OAuth) user to other org (User not found) #88269

Closed
ijonjic11 opened this issue May 24, 2024 · 4 comments
Closed

Comments

@ijonjic11
Copy link

What happened?

After upgrade to Grafana 11.0. , because of following feature:

Auth: Force lowercase login/email for users.

Grafana changed all existing user data (login/email) to lowercase which works good in the end, but for new users that do the Sign-up for the first time and they choose uppercase variation of there email, this mechanism does not work.

For this reason, newly added users cannot be moved to another organization, i'm getting "User not found" message every time i try to assign them to new org.

Is there a way that i can run lowercase force again?

What did you expect to happen?

Grafana should automatically force newly signed up users to lowercase.

Did this work before?

Yes, because in earlier versions of Grafana there was no lowercase forcing.

How do we reproduce it?

  1. Integrate OAuth Auth mechanism with Grafana
  2. Sign-up(not login, no issues later if sign-up is with lowercase) with uppercase user, for example Name.Surname@example.com
  3. Try assign newly added user to another organization

1.b. Normal sign-up (without OAuth) probably should be enough to reproduce it.

Is the bug inside a dashboard panel?

No response

Environment (with versions)?

Grafana: Grafana 11.0
OS: Debian 12
Browser: Opera

Grafana platform?

A package manager (APT, YUM, BREW, etc.)

Datasource(s)?

No response

@fti-lit
Copy link

fti-lit commented Jun 5, 2024

Same problem with LDAP Auth.

Using POST api/orgs/2/users returns "message": "User not found".

Using GET api/users/lookup?loginOrEmail=John Doe also returns "message": "user not found".

I couldn’t update via PUT api/users/123 because "message": "User info cannot be updated for external Users".

But after updating login/email in the grafana.db, POST api/orgs/2/users was succeful.

@ijonjic11
Copy link
Author

Hi @fti-lit ,

can you be more specific regrading db update, what tables did you updated,only "user" table or there is more?

Thanks is advance!

@fti-lit
Copy link

fti-lit commented Jun 5, 2024

I add to:

  • stop the grafana service
  • save grafana.db
  • chown grafana.db to root:root
  • update user set login='john doe', name='john doe' where id = 123
  • chown grafana.db to grafana:grafana
  • restart grafana service

@ijonjic11
Copy link
Author

Okay,thanks a lot for the help. This also worked for me.

Just for the record, i'm using postgresql instead sqlite so i just made connection to db via DBeaver, found User table and manually changed records without any downtime.

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

No branches or pull requests

3 participants