Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhook event returns admin_api in triggered_by field for actions performed in Portal #4303

Open
buildbro opened this issue Jun 12, 2024 — with Linear · 4 comments
Labels
cooldown/enhancement minor enhancement that users can see

Comments

Copy link
Contributor

I tried working with Authgear webhooks recently and I made the following observation:
Although, this file contains the system and portal as source of event (triggered_by), while testing some webhooks, I got the old admin_api as source for events like adding and deleting a user via the Portal.

I was expecting triggered_by: 'portal'

@louischan @tung2744

@louischan-oursky
Copy link
Collaborator

[I] $ rg 'TriggeredByPortal'
pkg/api/event/context.go
24:     // TriggeredByPortal means the event originates from the management portal.
25:     TriggeredByPortal TriggeredByType = "portal"

pkg/api/event/nonblocking/project_collaborator_deleted.go
26:     return event.TriggeredByPortal

pkg/api/event/nonblocking/project_domain_verified.go
25:     return event.TriggeredByPortal

pkg/api/event/nonblocking/project_domain_deleted.go
25:     return event.TriggeredByPortal

pkg/api/event/nonblocking/project_app_created.go
24:     return event.TriggeredByPortal

pkg/api/event/nonblocking/project_domain_created.go
25:     return event.TriggeredByPortal

pkg/api/event/nonblocking/project_billing_subscription_status_updated.go
25:     return event.TriggeredByPortal

pkg/api/event/nonblocking/project_billing_subscription_updated.go
25:     return event.TriggeredByPortal

pkg/api/event/nonblocking/project_app_secret_viewed.go
24:     return event.TriggeredByPortal

pkg/api/event/nonblocking/project_collaborator_invitation_deleted.go
25:     return event.TriggeredByPortal

pkg/api/event/nonblocking/project_app_updated.go
28:     return event.TriggeredByPortal

pkg/api/event/nonblocking/project_collaborator_invitation_accepted.go
25:     return event.TriggeredByPortal

pkg/api/event/nonblocking/project_billing_subscription_cancelled.go
25:     return event.TriggeredByPortal

pkg/api/event/nonblocking/project_billing_checkout_created.go
25:     return event.TriggeredByPortal

pkg/api/event/nonblocking/project_collaborator_invitation_created.go
25:     return event.TriggeredByPortal

Currently, only above events havetriggered_by: 'portal'. If you perform Admin API operations via the portal, the portal calls Admin API for you, so the triggered_by is still Admin API. Maybe we want another field to tell how Admin API was called (either by portal or by non-portal)

Copy link
Contributor Author

Thanks for clearing that. I think mentioning the above in the doc can serve for now.

Copy link
Member

fungc-io commented Jun 20, 2024

@louischan, i think it maybe make sense to have triggered by "portal" for the webhook in the future, but it may lead to compatibility issue,
let's put into backlog

@fungc-io fungc-io added the cooldown/enhancement minor enhancement that users can see label Jun 25, 2024 — with Linear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cooldown/enhancement minor enhancement that users can see
Projects
None yet
Development

No branches or pull requests

3 participants