'Adding Authentication with Facebook and Google in Flutter app without Firebase

I am working on a Flutter app and need to include the Facebook and Google login options in our app login page. I am not using Firebase and working on the MySQL database for storing and retrieving user's data.

I am looking for Adding the FB and Google authentication in my flutter app without the Firebase. I was not able to find any article for this. Everywhere it is always using the Firebase.

After following a tutorial, I have registered my app in FB Developer console, but I am not sure what will be put in the 'OAuth redirect URL' field there.

Currently, I am using xampp server and nodeJS for server side handling. Below is the code which I am calling on my button click. I am using plugin for Facebook authentication(Please let me know if this plugin is specifically for Firebase).

void initiateFacebookLogin() async {
    var facebookLogin = FacebookLogin();
    facebookLogin.loginBehavior = FacebookLoginBehavior.webViewOnly;
    print("Inside fb login");
    var facebookLoginResult = await facebookLogin
        .logInWithReadPermissions(['email', 'public_profile']);
    switch (facebookLoginResult.status) {
      case FacebookLoginStatus.error:
        print("Error");
        onLoginStatusChanged(false);
        break;
      case FacebookLoginStatus.cancelledByUser:
        print("CancelledByUser");
        onLoginStatusChanged(false);
        break;
      case FacebookLoginStatus.loggedIn:
        print("LoggedIn");

        var graphResponse = await http.get(
            'https://graph.facebook.com/v2.12/me?fields=name,first_name,last_name,email,picture.height(200)&access_token=${facebookLoginResult.accessToken.token}');

        var profile = json.decode(graphResponse.body);
        print(profile.toString());

        onLoginStatusChanged(true, profileData: profile);
        break;
    }
  }


Solution 1:[1]

As mentioned in the comments, both Facebook and Google Sign in can work without Firebase. There's a sample code for Flutter google_sign_in package that you can try here.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Omatt