Last active
June 27, 2023 08:30
-
-
Save kanzitelli/e5d198e96f81b7a8263745043766127c to your computer and use it in GitHub Desktop.
React Native Trick: Get Cookies of WebView without using any native modules such as react-native-cookies. Might be helpful for getting JWT while making OAuth2 👽
Good trick! Thank you for sharing it.
Nice trick, but we can't read HttpsOnly cookies :(
Same is security if use postMessage...
where did you pass the cookies to the URL ?
const jsCode = 'window.ReactNativeWebView.postMessage(document.cookie)';
New webview version use this line.
encountered one same issue, it doesn't return complete cookies
the output is something like below:
["okta-oauth-nonce=wTMKiRCNxXPV8ooXPQ0pYLtlbvlzfV0SsjeH4s9NpquArJjzWu9ZbUl6es4deVyb", " okta-oauth-state=X5AKl6fUj3hGDFf3BsGsnzxyXyMhuuc73lsvzYZHy5s8viUbZ8fUjNIZVJsMMxhs", " ln=[email protected]"]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The injection happens after page load. Maybe try programmatically changing the webview url. That worked for me.