Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google login using in app web-view in react-native

I have implemented a web-view in react-native which

  • opens up website in web view let say (example.com)
  • shows up a google login button on (example.com/login)

I am trying to login via web-view and open whole website in web-view inside app

  <View style={{ flex: 1 }}>
    <WebView
      source={{
        uri: "https://example.com"
      }}
      style={{flex: 1}}
    />
  </View>

When I tried to click on google login button, I get this error

enter image description here

like image 385
WitVault Avatar asked Jun 25 '26 10:06

WitVault


1 Answers

you have to privide user agent User agent in my case

<WebView
userAgent={DeviceInfo.getUserAgent() + " - MYAPPNAME - android "}   
ref={"WEBVIEW"}
automaticallyAdjustContentInsets={false}
source={{uri: this.state.url}} />
like image 169
Aurangzaib Rana Avatar answered Jun 28 '26 07:06

Aurangzaib Rana