DEV Community

Cover image for Flutter Webview Google Sigin Issue (403)
Suraj975
Suraj975

Posted on • Updated on

Flutter Webview Google Sigin Issue (403)

Webview has been one of the great things in-app community that has helped developers to convert a responsive website into a mobile application. And with flutter, it has reduced the time and line of codes through a simple flutter webview widget that supports both android and ios platforms.

However, when things become simple it brings issues with it, which I faced while converting my site [https://www.codingnotesonline.com/] into a mobile application using flutter.

For my site, I used firebase as a database for storing data and using social signup methods (Google, Facebook & Github).

Facebook and Github work perfectly, while for google it showed a 403 error as seen in the below pic.

Alt Text

To make this work you just need to add Useragent into your flutter webview widget body.

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
       debugShowCheckedModeBanner: false,
      home: Scaffold(
        body:WebView(
          userAgent: "random", //Add this to resolve issue
          initialUrl: 'https://your-url/',
          javascriptMode: JavascriptMode.unrestricted,
        ),
      ),
    );
  }
}

I hope this helped you and saved a lot of your time finding the solution for it. I will keep you guys posted with other issues such as share options in flutter webview.

Top comments (1)

Collapse
 
enaranjosaca profile image
enaranjosaca

Excelente me funciono correctamente amigo, gracias