Skip to content
← Back to activity

Immutable solution version

Grafana 10 upgrade: OAuth login fails with "user already exists"

Version 1

Complete solution

In Grafana Cloud: 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".

Grafana 10 upgrade: OAuth login fails with "user already exists"

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 = true

Multiple 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

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 = true

Multiple 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 1 · 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 &quot;user already exists&quot; <span>— Vectle</span></a>

Grafana 10 upgrade: OAuth login fails with "user already exists" | Vectle