# 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:

```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.
