Doc guidance on passing cookie to react-native-webview #1303

Closed
opened 2026-03-13 08:32:02 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @Lantianyou on GitHub (Jun 4, 2025).

Is this suited for github?

  • Yes, this is suited for github

No response

Describe the solution you'd like

Adding docs on how to pass cookie to webview. https://www.better-auth.com/docs/integrations/expo

Describe alternatives you've considered

I really struggle with issue cause I think the cookie set by better auth backend is HttpOnly, so I cannot use injectJavaScript to set the cookie on client side

 <WebView
        ref={webviewRef}
        originWhitelist={["*"]}
        javaScriptEnabled
        webviewDebuggingEnabled
        style={{ paddingTop: height }}
        className="flex-1"
        source={{ uri }}
        sharedCookiesEnabled
        thirdPartyCookiesEnabled
        injectedJavaScript={`document.cookie = 'better-auth.session_token=lqVHOjvJ2uOVAlKKweiSzff4hTnUdlbb.uRyOTKvSWgIjH5zhjygMmewNSDi99EsOWbGeAcASAWc%3D; path=/;'; true;`}
        domStorageEnabled
      />

Additional context

No response

Originally created by @Lantianyou on GitHub (Jun 4, 2025). ### Is this suited for github? - [ ] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. _No response_ ### Describe the solution you'd like Adding docs on how to pass cookie to webview. https://www.better-auth.com/docs/integrations/expo ### Describe alternatives you've considered I really struggle with issue cause I think the cookie set by better auth backend is HttpOnly, so I cannot use injectJavaScript to set the cookie on client side ``` <WebView ref={webviewRef} originWhitelist={["*"]} javaScriptEnabled webviewDebuggingEnabled style={{ paddingTop: height }} className="flex-1" source={{ uri }} sharedCookiesEnabled thirdPartyCookiesEnabled injectedJavaScript={`document.cookie = 'better-auth.session_token=lqVHOjvJ2uOVAlKKweiSzff4hTnUdlbb.uRyOTKvSWgIjH5zhjygMmewNSDi99EsOWbGeAcASAWc%3D; path=/;'; true;`} domStorageEnabled /> ``` ### Additional context _No response_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1303