facebookProvider function

Implementation

OAuthProvider<FacebookProfile> facebookProvider(
  FacebookProviderOptions options,
) {
  return OAuthProvider<FacebookProfile>(
    id: 'facebook',
    name: 'Facebook',
    clientId: options.clientId,
    clientSecret: options.clientSecret,
    authorizationEndpoint: Uri.parse(
      'https://www.facebook.com/v18.0/dialog/oauth',
    ),
    tokenEndpoint: Uri.parse(
      'https://graph.facebook.com/v18.0/oauth/access_token',
    ),
    userInfoEndpoint: Uri.parse(
      'https://graph.facebook.com/me?fields=id,name,email,first_name,last_name,picture',
    ),
    redirectUri: options.redirectUri,
    scopes: options.scopes,
    profileParser: FacebookProfile.fromJson,
    profileSerializer: (profile) => profile.toJson(),
    profile: (profile) {
      return AuthUser(
        id: profile.id,
        name: profile.name,
        email: profile.email,
        image: profile.picture?.url,
        attributes: profile.toJson(),
      );
    },
  );
}