How to use Google OAuth in FlutterFlow

Custom Code

I am trying to add Google OAuth functionality through a custom action in FlutterFlow. However, when I tried the recommended code on the pocketbase documentation, nothing happens.

I did all the necessary google api key stuff and connected it to pocketbase.

I created a custom action trigged when I press a button, here's the custom action code:

// Automatic FlutterFlow imports
import '/backend/schema/structs/index.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

import 'package:pocketbase/pocketbase.dart';
import 'package:url_launcher/url_launcher.dart';

Future signInWithGoogle() async {
  final pb = PocketBase('https://mydomain.com'); // Not actually my domain
  print("Hello");

  final authData =
      await pb.collection('users').authWithOAuth2('google', (url) async {
        await launchUrl(url);
  }, scopes: ['email']);
}

Am I missing something?

Any help would be greatly appreciated.

What have you tried so far?

I did all the necessary google api key stuff and connected it to pocketbase. I created a custom action trigged when I press a button which executes this code.

Did you check FlutterFlow's Documentation for this topic?
Yes
1