Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed Facebook Login #102

Merged
merged 1 commit into from
Oct 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions lib/services/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import 'package:books_app/providers/user.dart';
import 'package:books_app/services/database_service.dart';
import 'package:books_app/utils/keys_storage.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter_login_facebook/flutter_login_facebook.dart';
import 'package:google_sign_in/google_sign_in.dart';

class FirebaseAuthService {
static String fbauthtoken = '';
static String googleAuthToken = '';
final FirebaseAuth firebaseAuth = FirebaseAuth.instance;
final FacebookLogin facebookLogin = FacebookLogin();

dynamic get currentUserFromFireBase {
return firebaseAuth.currentUser;
Expand All @@ -19,12 +17,6 @@ class FirebaseAuthService {
return firebaseAuth.currentUser.uid;
}

Future<void> facebookSignout() async {
await firebaseAuth.signOut().then((void onValue) {
facebookLogin.logOut();
});
}

Future<void> googleSignout() async {
GoogleSignIn().disconnect();
await firebaseAuth.signOut();
Expand All @@ -46,29 +38,6 @@ class FirebaseAuthService {
return userData;
}

Future<void> signInWithFacebook() async {
final FacebookLoginResult attempt = await facebookLogin.logIn();
final OAuthCredential credential =
FacebookAuthProvider.credential(attempt.accessToken.token);
final UserCredential result =
await firebaseAuth.signInWithCredential(credential);

final User user = result.user;

if (user == null) return;

final String idToken = await user.getIdToken(true);
print('ID token received from user.getIdToken(true) is $idToken');

// try {
// fbauthtoken = await BackendService().loginWithSocialMedia(idToken);
// print('facebook token is $fbauthtoken');
// } catch (error) {
// print(error.toString());
// }
return user;
}

Future signInWithGoogle() async {
final GoogleSignInAccount attempt = await GoogleSignIn().signIn();
final GoogleSignInAuthentication authentication =
Expand Down