ID-Q06Scenario IntermediateIdentity & SSO#integration#identity#oauth

An integration using the OAuth username-password flow suddenly fails with 'invalid_grant'. What's going on and what do you do?

Your confidence:Not rated

Model answer

Likely causes

  • The username-password flow is blocked in the org (default for orgs created from Summer '23, and being phased out more broadly) โš‘ verify current retirement timeline.
  • The integration user's password or security token changed, or the user was frozen, deactivated or locked out.
  • The app's policies changed (permitted users, IP restrictions).

Diagnose: login history for the integration user shows the failure reason (for example Username-Password Flow Disabled).

Fix properly

  1. Create an External Client App with JWT bearer (certificate) or client credentials.
  2. Use a dedicated integration user (Salesforce Integration licence, API-only, least privilege), pre-authorised through a permission set.
  3. Update the client (for example the middleware connector's connection type), test in a sandbox, switch production.
  4. Remove the old app's access and the stored password.

Re-enabling the username-password flow, where still possible, is only a short-term bridge.

โœ” Key points to hit

โœ– Red-flag answers

  • Just resetting the security token
  • Permanently re-enabling the legacy flow

โ†ช Follow-ups

Why is the username-password flow considered insecure?

The client must store and send the user's password (and token), it can't use MFA, and leaked credentials give full access as that user.

What's the quickest secure alternative?

Client credentials with an ECA and a run-as integration user: no certificates to manage, though the secret must be protected and rotated. JWT bearer is stronger when certificates can be managed.