Skip to content

Conversation

@IfDougelseSa
Copy link

Description

Fixes plugin notifications for SSO-authenticated users by querying the SSO provider's external_id instead of using the notification plugin's name.

Problem

Plugin notifications were failing for users authenticated via SSO (GitHub OAuth, Google, SAML, etc.) because the code was looking up external_id using the notification plugin's name instead of the SSO authentication provider.

Example:

  • User logs in via provider = "github" (SSO)
  • Code searches for provider = "discord" (notification plugin)
  • No match found → ReceiverExternalID is empty

Solution

Query all external logins for the user and use the most recent one (ORDER BY updated_at DESC).

Changes

  • Add ORDER BY updated_at DESC to GetUserExternalLoginList
  • Update notification code to query all external logins
  • Use first login from ordered list (most recent)

Testing

Before:
Receiver External ID: ← Empty

After:
Receiver External ID: 81540136 ← Populated

Tested with GitHub OAuth SSO and test notification plugin.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants