DEV Community

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

Posted on • Edited on

12 4

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.

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (1)

Collapse
 
enaranjosaca profile image
enaranjosaca

Excelente me funciono correctamente amigo, gracias

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay