Skip to content
RED SAGSkills
hardMobile App Developer interview question

How would you implement secure login with an OAuth or OpenID Connect provider in a mobile app?

What the interviewer wants to hear

  • Use the authorization code flow with PKCE; no client secret in the app
  • Use the system browser (ASWebAuthenticationSession, Custom Tabs), not a WebView
  • Validate state and use verified redirect URIs
  • Store tokens securely and use short-lived access tokens with refresh
  • Handle refresh races, revocation and logout

Model answer

A mobile app is a public client, so it cannot keep a client secret. I use the authorization code flow with PKCE: the app creates a random code verifier, sends its hash with the authorization request, and proves possession when exchanging the code for tokens, so an intercepted code is useless. The login page opens in the system browser through ASWebAuthenticationSession or Android Custom Tabs, never an embedded WebView, so the app cannot see the password and the user gets shared sessions and password managers. I check the state parameter and use verified https redirects where possible. Libraries like AppAuth handle these details. Tokens are stored in the Keychain or Keystore-backed storage, access tokens are short-lived, and refresh happens in one place with a lock to avoid races. Logout revokes tokens on the server and clears local data.

Can you answer it under time pressure?

Take a timed hard round and get scored on every answer.

Start mock interview

More hard Mobile App Developer questions