IDENTITY-AND-ACCESS-MANAGEMENT-ARCHITECT practice question 17 of 30

Universal Containers (UC) wants to build a custom mobile app for their field reps to create orders in salesforce. After the first time the users log in, they must be able to access salesforce upon opening the mobile app without being prompted to log in again. What Oauth flows should be considered to support this requirement?

Full set: 248 questions
Answer options
A: Web Server flow with a Refresh Token. Correct answer
B: Mobile Agent flow with a Bearer Token.
C: User Agent flow with a Refresh Token.
D: SAML Assertion flow with a Bearer Token.
Correct Answer:
A. Web Server flow with a Refresh Token.
Explanation

The requirement is for a custom mobile app to maintain access to Salesforce without requiring the user to log in repeatedly. This is achieved using a refresh token, which allows the app to obtain a new access token non-interactively. For a native mobile application (a public client that cannot securely store a client secret), the industry best practice and most secure OAuth 2.0 flow is the Authorization Code Grant with the Proof Key for Code Exchange (PKCE) extension. In Salesforce terminology, this is an implementation of the Web Server flow. This flow is designed to be secure for public clients and provides the necessary refresh token for long-term access.

Why Incorrect

B. Mobile Agent flow with a Bearer Token: "Mobile Agent flow" is not a standard or officially named Salesforce OAuth 2.0 flow. A Bearer Token is a type of token, not a flow.
C. User Agent flow with a Refresh Token: While Salesforce allows this flow for mobile apps, it is explicitly documented as less secure than the Web Server flow because the access token is exposed in the URL. Security best practices (IETF RFC 8252) advise against this flow for native apps.
D. SAML Assertion flow with a Bearer Token: This is a non-interactive flow used for server-to-server integration where a client uses a previously obtained SAML assertion to gain access. It is not suitable for an initial, user-interactive login from a mobile app.

References

1. Salesforce Help Documentation, OAuth 2.0 Web Server Flow for Web App Integration: "To get a refresh token, you must request the refreshtoken scope... This flow is also used by native mobile apps, which use the Salesforce Mobile SDK. Because native apps can’t keep the client secret confidential, don’t include the clientsecret parameter in the token request. Salesforce recommends using the Proof Key for Code Exchange (PKCE) extension to secure the authorization flow for native apps."

2. Salesforce Help Documentation, OAuth 2.0 User-Agent Flow for Desktop or Mobile App Integration: "Because the access token is passed in the redirect URL, the user-agent flow is less secure than the web server flow... For this reason, we recommend using the OAuth 2.0 web server flow with the Proof Key for Code Exchange (PKCE) extension instead."

3. IETF, RFC 8252, OAuth 2.0 for Native Apps, Section 8.2: "The best current practice for native apps is to use the authorization code grant type... Public native app clients MUST implement the Proof Key for Code Exchange (PKCE) extension to OAuth." This standard explicitly deprecates the use of the Implicit flow (User-Agent flow) for native apps.

4. Salesforce Architects, Salesforce Identity and Access Management Architecture, Page 14: Discusses the Authorization Code flow (Web Server flow) with PKCE as the recommended pattern for securing public clients like single-page and native mobile applications, highlighting its security advantages over the Implicit flow (User-Agent flow).

Scroll to Top