goauthentik / goauthentik/authentik

Source connection.save() IntegrityError when the user is already linked

Open
#25,331 1 comment 1 reaction 0 assignees Claimed by @groundsada View on GitHub
bug bug/confirmed
Dominant language
Python
Stars
25.6k
Forks
2k
Avg merge
1d 1h
Merged PRs (30d)
644

Description

## What

on source connection.save() when the user is already linked (CILogon email_link / OAuth source duplicate key).

## Want

- On source connection.save() when the user is already linked (CILogon email_link / OAuth source duplicate key)

## Ideas this came from

- [#20975 `email_link` throws `IntegrityError` when user already has a connection to the same source (CILogon / multi-identity provider broker scenario)](https://github.com/goauthentik/authentik/issues/20975) — When usermatchingmode = emaillink is configured, and a user who already has a UserSourceConnection to a source logs in via the same source with a different iden
- [#22567 IntegrityError (duplicate key) on connection.save() with OAuth Source](https://github.com/goauthentik/authentik/issues/22567) — This is a follow up to the (closed) issue: https://github.com/goauthentik/authentik/issues/16754 I can confirm that we see the same issue (connect.save() is cal

Contributor guide

Open the contributing guide

Research direction

Start by tracing source connection.save() for the CILogon email_link and OAuth source flows, then review issues #20975 and #22567 for the duplicate-key scenarios. Done means a user already linked to the same source can authenticate again without an IntegrityError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.