Kraman says not to send information users should not see through API responses, include it in app code, or store it in AsyncStorage. In one example, an API returned email addresses and phone numbers that the app did not display; a security researcher found them in network traffic and reported the issue for a reward. Kraman’s lesson is to filter data and permissions on the server.
Security And Authentication In React Native
Speaker
Kadi Kraman, a senior React Native engineer at Formidable, discusses app security and authentication at React Native EU 2019, hosted by Callstack.
Kraman describes routing phone traffic through Charles Proxy to inspect API requests, with an SSL certificate installed to view encrypted traffic. She found that an app’s refresh-token exchange exposed an auth token that could be used to explore its API. AsyncStorage is unencrypted, so she recommends native secure storage options such as iOS Keychain and Android Shared Preferences, with encryption for sensitive data.
Kraman explains that OAuth 2 lets an app obtain a token after a user grants authorization, while OpenID Connect adds an authentication layer and supports sign-in through providers such as Google, Twitter, or GitHub. The flow sends the user to an authorization server, returns an authorization code to the app, then exchanges that code for a token. Client secrets offer no security in a native app because its code can be inspected.
On mobile, multiple apps may be able to handle the same redirect scheme, allowing a malicious app to intercept an authorization code through scheme squatting. Kraman explains that PKCE adds a code challenge to the authorization request and requires the matching key during the token exchange. She points to AppAuth for Android and iOS and React Native AppAuth as libraries that handle this flow.
Takeaways
- Filter private fields and permissions on the server before returning API data.
- Treat app code and network traffic as inspectable by users or third parties.
- Keep auth tokens out of AsyncStorage; use native secure storage and encryption.
- Use OAuth with PKCE for native app authentication, and rely on libraries such as React Native AppAuth.
Mentioned in this talk
Search inside this talk
What was claimed 9
- role atKadi Kraman is engineering manager at Formidable
“I'm a senior React Native engineer at Formidable.”
YouTube Verified2 sources· Talk
- usesKadi Kraman uses Charles Proxy
“I used an old iPhone, just in case, a MacBook Pro, Charles Proxy, and my home Wi-Fi”
YouTube Unverified1 source· Talk
- featureAsyncStorage: Unencrypted persistent key-value storage that is global to an app
“a simple, unencrypted, asynchronous, persistent key-value storage system”
YouTube Unverified1 source· Talk
- featurePKCE: Binds authorization and token exchange using a code challenge and verifier to mitigate scheme-squatting attacks
“designed to make OAuth on mobile clients secure”
YouTube Unverified1 source· Talk
- featureAppAuth: Handles authentication and the PKCE extension
“native libraries that handle authentication as well as the PKCE extension”
YouTube Unverified1 source· Talk
- uses
“The GIF I showed earlier for authentication uses React Native AppAuth.”
YouTube Unverified1 source· Talk
- featureReact Native AppAuth: Provides React Native access to native authentication libraries for Android and iOS
“a bridge for both Android and iOS that you can use with React Native”
YouTube Unverified1 source· Talk
- integrates withReact Native AppAuth integrates with AppAuth
“a bridge for both Android and iOS”
YouTube Unverified1 source· Talk







