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.

@LinkinStars
Copy link
Member

@IfDougelseSa Originally, this notification plugin was designed to provide consistent notification functionality when users log in with the same account. For example, logging in with Slack would trigger corresponding Slack notifications. Of course, the scenario you mentioned is indeed an issue—users can configure different login methods and notification channels.

Therefore, our recommendation is to retain both query methods. By default, it will use externalLogins[0].ExternalID, but it will also retain the query via fn.Info().SlugName. This way, if plugins for the same external system exist, notifications from that specific external system will take precedence.

@LinkinStars LinkinStars self-assigned this Dec 25, 2025
@LinkinStars LinkinStars self-requested a review December 29, 2025 02:24
@LinkinStars LinkinStars added this to the v1.7.2 milestone Dec 29, 2025
Copy link
Member

@LinkinStars LinkinStars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution.

@LinkinStars LinkinStars merged commit c8908b7 into apache:dev Dec 29, 2025
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