Hello everyone,
I’m currently refactoring a system and need advice on the most appropriate OAuth flow for my use case. I’ve reviewed the standard flows, but none seem to perfectly fit my needs. Here’s the context:
-
My platform generates user information that updates very frequently (several times per minute).
-
I need to share this information with an external third party, but only after explicit user consent.
-
The consent request is initiated from the third party’s website. Once granted, I can start sharing the data.
-
There are current two delivery methods:
-
API where the third party can fetch complete user information.
-
Webhook notifications (sent as lightweight alerts). The third party must call the API to get the complete data after receiving a webhook.
-
Additionally, I have an API to manage webhook subscriptions/lifecycle that also requires authorization via OAuth.
On the surface, getting user consent and allowing data retrieval fits the Authorization Code Flow pattern:
-
The user logs in and accepts the contract.
-
Consent remains until revoked.
However, data sharing continues for a long time after consent (while the user is inactive or offline). Especially with webhooks, this starts feeling more like a server-to-server (B2B) integration than an ongoing “active user session” scenario, even though the data belongs to the user.
At this point I’m considering multiple options:
Option 1: Authorization Code Flow + user access/refresh token for each user
-
Pros:
-
Standard Authorization Code flow.
-
Third party doesn’t need to know my internal
userId.
-
-
Cons:
-
Third party must store two tokens per user (access + refresh).
-
More complex for integration.
-
Higher Auth0 token refresh load.
-
Doesn’t solve webhook API authorization (I’d still need Client Credentials flow separately).
-
Option 2: Authorization Code Flow (Consent) + Client Credentials Flow (Data/Webhooks)
-
Pros:
-
Third party only manages one token.
-
Works for both user data API and webhook lifecycle API.
-
Lower load on Auth0.
-
-
Cons:
-
Less “pure” OAuth flow (hybrid approach may confuse partners).
-
Requires exchanging
userIdin consent flow. -
Flow begins with user-based consent but continues as server-to-server.
-
My Questions
-
Is there a more appropriate flow or pattern for long-term, post-consent data sharing that still respects OAuth principles?
-
If not, which option above aligns better with industry best practices for this type of integration?
-
Any guidance on making the third party integration simpler without sacrificing security?
Thank you for your insights!