Issue
I am new to react native and first time using the react-native-webview. We already have website build using wordpress now I tried the develop the app for the website.
My issue was when I try to open the URL in webview it asking the credentials to login the page. but I have already login in the mobile, now I tried to open any website URL in webview it again asking the credentials to login.
I have searched in google since weeks but I don't have any clue.
Can anyone please let me know how to solve this issue or sent the login credentials to webview and open the URL.
<>
<ActivityIndicator visible={isLoading} />
<WebView
source={{
uri: 'https://.....',
}}
onLoadStart={() => setIsLoading(false)}
/>
</>
Solution
Solution : Use this code
<>
<ActivityIndicator visible={isLoading} />
<WebView
source={{
uri: 'https://.....',
headers: {
Authorization: `Bearer ${token}`,
},
}}
onLoadStart={() => setIsLoading(false)}
/>
</>
and then you need to set the cookie from backend .
Answered By - Anand Lamani
Answer Checked By - David Marino (JavaFixing Volunteer)