# Social Logins

#### How to add support for additional Providers like Facebook?

The Good thing about the library is it is written as a framework so you could easily add support for your provider of choice. &#x20;

For example, Google Auth (provided inbuilt) was implemented as follows.&#x20;

Comments explain all of how it happens.

```dart
/**
 * Extend AuthMethod to create a new method
 */
class Google extends AuthMethod {
  /**
   * Provide the look and feel of the Provider Button
   */
  @override
  Widget getLayout(bool isInSignIn, BuildContext context) {
    return Padding(
        padding: const EdgeInsets.all(0),
        child: NiceButton(
          elevation: 8.0,
          onPressed: () {
            /**
            * Kick off the signing Process
            */
            startSigning(context);
          },
          text: "Google",
          width: double.infinity,
          radius: 40,
          fontSize: 16,
          background: Color(0xffc4302b),
        ));
  }

  /**
    * Perform the siging process
   */
  @override
  Future<void> sign(bool isInSignIn, FirebaseAuth auth) async {
  
    final GoogleSignInAccount googleUser = await GoogleSignIn().signIn();

    final GoogleSignInAuthentication googleAuth =
        await googleUser.authentication;

    final GoogleAuthCredential credential = GoogleAuthProvider.credential(
      accessToken: googleAuth.accessToken,
      idToken: googleAuth.idToken,
    );

    return await FirebaseAuth.instance.signInWithCredential(credential);
  }
}
```

Now pass it as a list item to SignIn Widget auth param.

```dart
final widget = SignIn(
        themeColor: Colors.deepPurple,
        // Sign in and Sign Up fields are customizable in EmailConfig
        methods: [Google()],
        auth: FirebaseAuth.instance,
        onSuccess: (user, context, fields) {
          showSnackBar(
              'You made the signUp flow in record time. Cheers.', context);
          print('user: $user \n fields: $fields');
        },
      );
```

&#x20;One request in case you added support for some provider eg. Facebook please make a pull request to the repo with the code which will serve as an example. Fellow Developers will thank you!!!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://awesome11activity.gitbook.io/effortless-auth/social-logins.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
