ID-Q01โ˜… Must-prepareConceptual IntermediateIdentity & SSO#identity#oauth

Which OAuth flow would you use for: a mobile app, a middleware integration, a CLI tool, and a single-page web app?

Your confidence:Not rated

Model answer

ClientFlowWhy
Mobile app (user present, public client)Web server (authorization code) with PKCE + refresh tokenThe user logs in at Salesforce (SSO or MFA); no secret in the app; PKCE protects the code
Middleware (server-to-server)JWT bearer (or client credentials)No user interaction; certificate-based trust; dedicated integration user
CLI tool on a developer machineDevice flow (or web server with a local callback)Limited input; user approves in a browser
Single-page web appWeb server with PKCE (not implicit)Tokens don't appear in URLs; PKCE for public clients

Always add: minimal scopes, External Client App registration with admin-approved users where appropriate, token lifetime policies, and the fact that the username-password flow is blocked by default in newer orgs and not supported in ECAs.

โœ” Key points to hit

โœ– Red-flag answers

  • Username-password flow for the middleware
  • Implicit flow for a new SPA
  • Embedding a client secret in a mobile app

โ†ช Follow-ups

Where does the client secret live in a mobile app?

Nowhere: mobile apps are public clients. They use PKCE instead of a secret. Secrets belong only in confidential server-side clients.

How long should access tokens live?

Short (minutes to hours, per session policy), with refresh tokens governed by policy (expiry if unused, rotation). Server-to-server flows simply request a new token when it expires.