I have a react native application and a web shopify app.
In react native I use webview to display my shopify app for mobile.
I wonder how is it possible to share the authorization from mobile device webview + shopify.
Installing shopify sdk? or injecting cookies into webview? or injecting jwt token into webview?
if you had such an experience I appreciate sharing your knowledge with me.
The goal is to use shopify app in webview, but have authentication with biometrics on react native side.
გამარჯობა @batmanashvili !
Great question — you’re trying to bridge biometric authentication in React Native with authenticated access to a Shopify web app in a WebView, which isn’t trivial but definitely possible.
Recommended High-Level Strategy1. Authenticate the user natively (with biometrics + secure storage).
-
Fetch or generate a secure token (JWT/session cookie) after biometric auth.
-
Inject the token into the WebView securely (via headers or cookies).
-
Web app validates and uses the token to log the user into Shopify.
Option 1: Inject Shopify Session Cookie into WebView (Most Native)
If you’re using Shopify Admin API or embedded app model, Shopify expects a valid session token/cookie for access.
Implementation flow:1. React Native side (after biometric auth):
-
Use react-native-cookies or WebView injectedCookies feature (depending on platform):
-
import CookieManager from ‘@react-native-cookies/cookies’;
await CookieManager.set(‘https://yourshopifyapp.com’, {
name: ‘shopify_app_session’,
value: ‘YOUR_SESSION_TOKEN’,
domain: ‘yourshopifyapp.com’,
path: ‘/’,
version: ‘1’,
secure: true,
httpOnly: true,
});
-
Load WebView:
- <WebView source={{ uri: ‘https://yourshopifyapp.com’ }} />
- Shopify will now read this session cookie and treat the user as authenticated.
Option 2: Inject a JWT and Perform Login via URL Parameter or Header
Another route: generate a short-lived JWT on your server after biometric auth and inject it via WebView’s headers or URL param.
-
React Native app (after biometric):
-
WebView:
- <WebView
source={{
uri: ‘https://yourshopifyapp.com?auth_token=YOUR_JWT’,
}}
/>
-
Web App:
-
On load, detect the auth_token param.
-
Validate the JWT with your server.
-
If valid, create the session and set Shopify cookies internally.
-
Important: Make sure JWTs are:
Additional Tools & Libraries- react-native-webview: lets you inject JS, headers, or cookies.
Security Best Practices- Always validate tokens server-side — never in JS.
-
Secure tokens with short TTL and audience checks.
-
Avoid long-lived tokens or raw credentials in WebView.
-
Consider disabling copy/paste if sensitive info is passed.
Suggested Flow (Summary)
User opens app →
Biometric auth →
Get session JWT (or cookie) from backend →
Inject into WebView →
WebView loads Shopify app with valid auth →
User is seamlessly logged in
If this reply was useful to you, we would really appreciate it if you gave us a LIKE and mark the issue as SOLVED!