advancedScenario Questions

Scenario 5: Your team wants to allow a mobile app to call your API using OAuth2, but the mobile app can't safely store a client_secret. What do you recommend?

Use the Authorization Code grant with PKCE, treating the mobile app as a PUBLIC client (no client_secret at all). PKCE's dynamically generated code_verifier/code_challenge pair protects the exchange without requiring a static, embeddable secret that could be extracted from the compiled app.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Spring Ecosystem Mastery library.

Scenario 5: Your team wants to allow a mobile app to call your API using OAuth2, but the mobile app can't safely store a client_secret. What do you recommend?

Next Step

Continue to Scenario 6: A batch job needs to call an internal microservice API every night with no user involved. Which OAuth2 grant type fits, and how would you configure the resource server?← Back to all Spring Security questions