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

Can't login #18

Open
kazimad opened this issue Jun 9, 2020 · 16 comments
Open

Can't login #18

kazimad opened this issue Jun 9, 2020 · 16 comments

Comments

@kazimad
Copy link

kazimad commented Jun 9, 2020

  • start the app
  • click on "Login" - > infinity progress

error stacktrace

[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)
E/flutter (29515): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter (29515): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
E/flutter (29515):
E/flutter (29515): #2 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:349:48)
E/flutter (29515): #3 GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:218:23)
E/flutter (29515):
E/flutter (29515): #4 GoogleSignIn._addMethodCall (package:google_sign_in/google_sign_in.dart:257:20)
E/flutter (29515): #5 GoogleSignIn.signIn (package:google_sign_in/google_sign_in.dart:324:48)
E/flutter (29515): #6 FirebaseMethods.signIn (package:skype_clone/resources/firebase_methods.dart:44:62)
E/flutter (29515): #7 FirebaseRepository.signIn (package:skype_clone/resources/firebase_repository.dart:16:53)
E/flutter (29515): #8 LoginScreenState.performLogin (package:skype_clone/screens/login_screen.dart:62:17)
E/flutter (29515): #9 LoginScreenState.loginButton. (package:skype_clone/screens/login_screen.dart:49:26)
E/flutter (29515): #10 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14)
E/flutter (29515): #11 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:789:36)
E/flutter (29515): #12 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (29515): #13 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11)
E/flutter (29515): #14 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:264:5)
E/flutter (29515): #15 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:199:7)
E/flutter (29515): #16 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:467:9)
E/flutter (29515): #17 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:76:12)
E/flutter (29515): #18 PointerRouter._dispatchEventToRoutes. (package:flutter/src/gestures/pointer_router.dart:117:9)
E/flutter (29515): #19 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
E/flutter (29515): #20 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:115:18)
E/flutter (29515): #21 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:7)
E/flutter (29515): #22 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19)
E/flutter (29515): #23 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
E/flutter (29515): #24 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
E/flutter (29515): #25 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
E/flutter (29515): #26 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
E/flutter (29515): #27 _rootRunUnary (dart:async/zone.dart:1138:13)
E/flutter (29515): #28 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
E/flutter (29515): #29 _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7)
E/flutter (29515): #30 _invoke1 (dart:ui/hooks.dart:273:10)
E/flutter (29515): #31 _dispatchPointerDataPacket (dart:ui/hooks.dart:182:5)

@Ronak99
Copy link
Owner

Ronak99 commented Jun 10, 2020

Hey, please let me know, on which branch are you facing this issue? Or, are you facing this in the latest branch as well?

@kazimad
Copy link
Author

kazimad commented Jun 11, 2020

in master

@jeremiahseun
Copy link

I am having the same issue with login as well. After clicking on Login on the login screen and I click on the user to log in, the circular indicator just stays there and it refuses to log into the app.

@12amansharma
Copy link

I'm also having the same issue this happened when I followed this #3 and deleted all collections from my database since then I;m not able to login.

@takiuddin93
Copy link

takiuddin93 commented Jun 14, 2020

which branch are you guys on? @jeremiahseun @12amansharma @kazimad ? because in previous branches login was like this

if (isNewUser) {
_authenticationMethods.addDataToDb(user, token).then((value) {
Navigator.pop(context);
Navigator.of(context).push(MaterialPageRoute(
builder: (BuildContext context) => Dashboard()));
});
} else {
Navigator.pop(context);
Navigator.of(context).push(
MaterialPageRoute(builder: (BuildContext context) => Login()));
}

this was later changed to

if (isNewUser) {
_authenticationMethods.addDataToDb(user, token).then((value) {
Navigator.pop(context);
Navigator.of(context).push(MaterialPageRoute(
builder: (BuildContext context) => Dashboard()));
});
} else {
Navigator.pop(context);
Navigator.of(context).push(
MaterialPageRoute(builder: (BuildContext context) => Dashboard()));
}

Dashboard is the main page after login, you may have it named different..just clarifying.

so try changing this.

@takiuddin93
Copy link

in master

master branch has two files licence and readme..what are you making the app with?

@12amansharma
Copy link

I was on branch 6 when I got the error #3 while searching for the user so I did as it was there in the solution above and deleted all my firestore data and after that when I tried loging in then the circular indicator stays.

@takiuddin93
Copy link

I was on branch 6 when I got the error #3 while searching for the user so I did as it was there in the solution above and deleted all my firestore data and after that when I tried loging in then the circular indicator stays.

can I see your repo? or the login.dart file?

@12amansharma
Copy link

12amansharma commented Jun 14, 2020

Loginscreen.dart
Code is the same as Ronak's

`import 'package:adios_unite/resources/firebase_repository.dart';
import 'package:adios_unite/screens/home_screen.dart';
import 'package:adios_unite/utils/universal_variables.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart';

class LoginScreen extends StatefulWidget {
@OverRide
LoginScreenState createState() => LoginScreenState();
}

class LoginScreenState extends State {
FirebaseRepository _repository = FirebaseRepository();

bool isLoginPressed = false;

@OverRide
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: UniversalVariables.whiteColor,
body: Stack(
children: [
Center(
child: loginButton(),
),
isLoginPressed
? Center(
child: CircularProgressIndicator(),
)
: Container()
],
) ,

  );

}

Widget loginButton() {
return Shimmer.fromColors(
baseColor: Colors.orange,
highlightColor: UniversalVariables.whiteColor,
child: FlatButton(
padding: EdgeInsets.all(35),
child: Text(
"LOGIN",
style: TextStyle(
fontSize: 35,
fontWeight: FontWeight.w900,
letterSpacing: 1.2,)
),
onPressed: ()=>performLogin(),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
),
);
}

void performLogin(){
print("trying to perform login");

setState(() {
  isLoginPressed = true;
});

_repository.signIn().then((FirebaseUser user) {
  if (user != null) {
    authenticateUser(user);
  }
  else {
    print("There was an error");
  }
});

}

void authenticateUser(FirebaseUser user){
_repository.authenticateUser(user).then((isNewUser) {

  setState(() {
    isLoginPressed = false;
  });

  if(isNewUser){
    _repository.addDataToDb(user).then((value){
      Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) {
        return HomeScreen();
        }));
    });
  }  else{
      Navigator.pushReplacement(context, MaterialPageRoute(builder: (context){
        return HomeScreen();
      }));
  }
});

}

}`

@12amansharma
Copy link

Yes now it is working I had to manually add the database into the firestore.

@clintonksang
Copy link

could i request for your code?

@12amansharma
Copy link

it's same as ronak's https://github.com/12amansharma?tab=repositories

@AjayrajSingh
Copy link

@kazimad Have you upgraded google_sign_in and firebase_authentication plugins from the versions used in this repo?

@Ronak99
Copy link
Owner

Ronak99 commented Aug 16, 2020

@kazimad, If this issue is still not solved, kindly let me know the branch on which you are on, that way, I can update the code and resolve this issue for others in the Future. I tried running the app from several different branches, the authentication seems to work at my end, I couldn't locate the exact branch which might be causing this problem.

@Devbrail
Copy link

even now on master branch also same problem am facing
sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null
after attaching my firebase json file

@Devbrail
Copy link

even now on master branch also same problem am facing
sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null
after attaching my firebase json file

My problem related to SHA1 now its working fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants