How to make google cloud console auth service like Firebase google auth in Flutter?

Viewed 26

Hi im woking on app where the user can sing up using their Gmail accounts by google auth that its provided in google cloud console and that's the code I'm using

WebView(
  initialUrl: url,
  javascriptMode: JavascriptMode.unrestricted,
  gestureNavigationEnabled: true,
  userAgent: 'random',
  onWebViewCreated: (controller) {
    _controller = controller;
  },
  onPageStarted: (String newurl) async {
    if (newurl.startsWith(baseAPI)) {
      //display floating loader on top of the webview

      //TODO show progress
      isVisible.value = false;
    }
  },
  onPageFinished: (String newurl) async {
    if (newurl.startsWith(baseAPI)) {
      //get current page body
      var data = await readJS();

      //convert json String to json Object
      var decodedResp = json.decode(json.decode(data))['payload'];

      String token = decodedResp['Token'];

      final box = GetStorage();
      box.write('token', token);

      Get.offAll(() => const HomeScreen());

      //put data in state

      //redirect user to homepage

    }
  },
));

and it's working fine. but I dont like that the user have to sigin in munaly and type their email and password each time they need to ,I wanna make it like firebase when the user hit sign in button display a pop-up contain his google acounntes and choose from them just like this

-google auth pop-up

so in short I wanna make just like the image above but not with firebase but with google cloud service in flutter

any links ,code will be good . thanks

0 Answers
Related