Skip to content
Notifications
Clear all

Help: Can't get OAuth2 with Salesforce to work reliably

2 Posts
2 Users
0 Reactions
0 Views
(@infra_auditor_nina)
Reputable Member
Joined: 4 months ago
Posts: 159
Topic starter   [#10341]

Spent the last three days auditing our Salesforce integration via OAuth2 in Flux. It's a masterclass in how "simple" configurations can become a reliability nightmare. The handshake works… until it doesn't. Random token refreshes fail, and the logs are about as helpful as a screen door on a submarine.

Our setup is ostensibly standard: JWT bearer flow. The key points:
- A connected app in Salesforce with the correct cert.
- A `FluxSource` for the OAuth2 provider.
- The requisite secret with private key.

Yet, we see intermittent 401s mid-sync. The postmortem from last week's partial outage pointed to token expiration, but the refresh logic *should* handle it. Is Flux's internal token cache being invalidated prematurely, or is there a clock skew issue with the identity provider?

Here's the provider snippet:

```yaml
apiVersion: v1
kind: Secret
metadata:
name: salesforce-credentials
type: Opaque
stringData:
clientID:
clientSecret: ""
token: eyJ... (long JWT)
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: FluxSource
metadata:
name: salesforce-source
spec:
provider:
salesforce:
auth:
oauth2:
clientID:
tokenSecret:
name: salesforce-credentials
key: token
```

Has anyone else fought this beast? Specifically:
* How are you monitoring actual token expiry vs. Flux's perceived expiry?
* Any patterns for forcing a proactive refresh before critical sync windows?
* Seen issues with Salesforce instance URLs (my.salesforce.com vs. login.salesforce.com) causing silent auth failures?

The cost of these flaky integrations isn't just engineering time; it's data drift and compliance gaps.


- Nina


   
Quote
(@jacksonw)
Estimable Member
Joined: 7 days ago
Posts: 63
 

Yeah, the "works until it doesn't" part is so familiar. We had similar headaches with a different connector last year.

> Is Flux's internal token cache being invalidated prematurely
This made me think: did you check if you're hitting the concurrent session limits on the Salesforce side? I've seen that cause what looks like random 401s, because it invalidates tokens from other sessions.

Also, with JWT, I've always been paranoid about the system clock on the Flux server. A small skew can ruin your day. Are you using NTP on those boxes?

Sorry, I'm still new to Flux itself - does it expose any metrics for token refresh attempts versus failures? That'd be my first stop for debugging the refresh logic.


not a buyer, just a nerd


   
ReplyQuote