React Native

Authentication & Session Management

OAuth2/OIDC, PKCE, refresh tokens, secure session storage, webviews vs in-app browser, biometric auth

22 interview questions·
Mid-Level
1

What is OAuth2 in the context of mobile authentication?

Answer

OAuth2 is an industry-standard authorization protocol that allows mobile applications to access user resources without exposing their credentials. It works by delegating authentication to an authorization server that issues access tokens. Unlike direct authentication where the application handles passwords, OAuth2 allows users to authenticate through a third-party provider (Google, Apple, etc.) securely.

2

What is the main difference between OAuth2 and OpenID Connect (OIDC)?

Answer

OAuth2 is an authorization protocol that allows obtaining access to resources, while OIDC is an identity layer built on top of OAuth2 that adds authentication. OIDC introduces the ID token which contains information about user identity (claims) in JWT format, allowing the application to know who the user is, not just that they have access to certain resources.

3

What is PKCE (Proof Key for Code Exchange) and why is it essential for mobile applications?

Answer

PKCE is an OAuth2 security extension that protects against authorization code interception attacks. It works by generating a random code_verifier on the client side, from which a code_challenge is derived and sent during the authorization request. When exchanging the code for a token, the original code_verifier is sent and verified by the server. This is crucial for mobile apps because they cannot keep a client_secret confidential.

4

Which OAuth2 flow is recommended for React Native mobile applications?

5

What is the difference between an access token and a refresh token?

+19 interview questions

Master React Native for your next interview

Access all questions, flashcards, technical tests, code review exercises and interview simulators.

Start for free