Solution skill
Grafana 10 upgrade: OAuth login fails with "user already exists"
Complete solution
Shows how to fix grafana 10 upgrade: OAuth login fails with "user already exists". Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
The users were created by OAuth in 9.x, and nothing in the OAuth config had changed. This is the documented Grafana v10 breaking change: OAuth integrations no longer look users up by email, which is how your 9.x users were matched.
When to use
You are seeing this: After upgrading Grafana 9.x to 10.0, existing users got Login Failed: user already exists when logging in through generic OAuth (ADFS, Keycloak, CILogon) or even Google OAuth. Use this skill when you run into "Grafana 10 upgrade: OAuth login fails with "user already exists"".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
What's going on
After upgrading Grafana 9.x to 10.0, existing users got Login Failed: user already exists when logging in through generic OAuth (ADFS, Keycloak, CILogon) or even Google OAuth. The users were created by OAuth in 9.x, and nothing in the OAuth config had changed. Rolling back to 9.x made it work again.
The verified fix
This is the documented Grafana v10 breaking change: OAuth integrations no longer look users up by email, which is how your 9.x users were matched. Existing accounts cant be found by email anymore, so the signup path fails with "user already exists".
The quick fix (marked insecure in the docs, so use with eyes open) is re-enabling email lookups in grafana.ini:
[auth]
oauth_allow_insecure_email_lookup = trueMultiple reporters confirmed this let their users log in again. The proper fix is making the login deterministic instead: set login_attribute_path (e.g. username for Keycloak) in [auth.generic_oauth] so Grafana matches users by the provider's login field rather than email, then you can leave the insecure lookup off.
How to use this
Take the question above and check if it matches what you're seeing. If it does, work through the verified fix step by step. Start with the cause described first, because that's what tells you the fix applies to your setup, then apply the changes in the order given. Verify by re-running whatever failed before, and expect the same behavior the thread author reported.
Evidence
Someone asked: After upgrading Grafana 9.x to 10.0, existing users got Login Failed: user already exists when logging in through generic OAuth (ADFS, Keycloak, CILogon) or even Google OAuth. The users were created by OAuth in 9.x, and nothing in the OAuth config had changed. Rolling back to 9.x made it work again. The verified answer: This is the documented Grafana v10 breaking change: OAuth integrations no longer look users up by email, which is how your 9.x users were matched. Existing accounts cant be found by email anymore, so the signup path fails with "user already exists".
The quick fix (marked insecure in the docs, so use with eyes open) is re-enabling email lookups in grafana.ini:
[auth]
oauth_allow_insecure_email_lookup = trueMultiple reporters confirmed this let their users log in again. The proper fix is making the login deterministic instead: set login_attribute_path (e.g. username for Keycloak) in [auth.generic_oauth] so Grafana matches users by the provider's login field rather than email, then you can leave the insecure lookup off.
Source: https://github.com/grafana/grafana/issues/70203 Discussion and confirmation live at https://vectle.com/threads/thr_JQEujTlH2m9BbvZ5j78-KA
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_if7RlWFuPZAJKMGozM3GKA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Grafana 10 upgrade: OAuth login fails with "user already exists" <span>— Vectle</span></a>