I downloaded the Android starter app an year ago and had written my code on top of it. The Google authentication used to work just fine till some time ago.
I have Google, Facebook and Yahoo authentication enabled.
I have implemented Gitkit v3 on my website where Google login is working fine currently.
Right now, on my Android app, custom user id authentication is working properly but Google authentication is not.
When Gmail Id is selected, nothing happens: neither onSignIn() nor onSignInFailed() gets fired.
Was any server side code changes implemented in this part in the last one year which was not backward compatible ?
===================================
In logcat, the following exception is seen when a Gmail Id is selected for Sign In :
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: Unrecoverable auth exception: Unknown
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: com.google.android.gms.auth.GoogleAuthException: Unknown
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.idp.google.GoogleIdpClient$1.call(GoogleIdpClient.java:131)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.idp.google.GoogleIdpClient$1.call(GoogleIdpClient.java:125)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.executor.ProgressRequestExecutor$2.doInBackground(ProgressRequestExecutor.java:84)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.executor.ProgressRequestExecutor$2.doInBackground(ProgressRequestExecutor.java:71)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at android.os.AsyncTask$2.call(AsyncTask.java:295)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at java.lang.Thread.run(Thread.java:818)
10-16 21:29:40.933 6453-6480/com.application.my_app E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9f1fb160
==========================
UPDATE 1
I tried using a new Client ID for Android and using it in my Python endpoint code. This did not help.
==========================
UPDATE 2
I created a new Client ID for Web application and used it in endpoint python file ( as WEB_CLIENT_ID ) and in AndroidManifest.xml ( as value of identitytoolkit.server_client_id ). The following exception still comes :
10-18 09:43:38.000 12063-15754/? W/GLSActivity: gms.StatusHelper Status from wire: INVALID_AUDIENCE status: null
10-18 09:43:38.000 12063-15754/? I/GLSUser: [GLSUser] getAuthtoken(<ELLIDED:-2092860235>, audience:server:client_id:My_NEW_Client_Id__For_Web_Application.apps.googleusercontent.com) -> status: UNKNOWN)
10-18 09:43:38.000 12063-15754/? I/GLSUser: [GLSUser] Extracting token using key: Auth
10-18 09:43:38.000 12063-15754/? W/GLSActivity: gms.StatusHelper Status from wire: INVALID_AUDIENCE status: null
10-18 09:43:38.050 1914-3643/? I/ActivityManager: Start proc 2421:com.google.android.partnersetup/u0a11 for broadcast com.google.android.partnersetup/.RlzPingBroadcastReceiver
10-18 09:43:38.117 12147-12257/? W/Icing: GetUsageReports fallback to slow seek
10-18 09:43:38.120 1914-2954/? I/ActivityManager: Killing 32316:com.android.defcontainer/u0a4 (adj 15): empty #17
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: Unrecoverable auth exception: Unknown
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: com.google.android.gms.auth.GoogleAuthException: Unknown
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.idp.google.GoogleIdpClient$1.call(GoogleIdpClient.java:131)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.idp.google.GoogleIdpClient$1.call(GoogleIdpClient.java:125)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.executor.ProgressRequestExecutor$2.doInBackground(ProgressRequestExecutor.java:84)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.executor.ProgressRequestExecutor$2.doInBackground(ProgressRequestExecutor.java:71)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at android.os.AsyncTask$2.call(AsyncTask.java:295)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at java.lang.Thread.run(Thread.java:818)
10-18 09:43:38.178 1233-1272/com.application.my_app E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9f355b50
Please help.
I was able to fix the problem, at least partially. The problem was that I had provided the "package" name where package name was asked for the keys on Google Developer Console. I should have provided the "applicationId" mentioned in my "build.gradle". In my case, both are different. Since in all documentation, it is mentioned to provide package name, I got confused.
After making that change, Google authentication is working. I am looking into Facebook authentication which is still not working.
I have migrated to the latest Gitkit libraries and I found the below functions missing in the new android library :
I am trying to figure out their workarounds :
IdToken idToken = client.getSavedIdToken();
Account account = client.getSavedAccount();
Below link would explain this part
http://tools.android.com/tech-docs/new-build-system/applicationid-vs-packagename
Relevant excerpt from the above link
Therefore, we have decoupled the two usages of package name: The final
package that is used in your built .apk's manifest, and is the package
your app is known as on your device and in the Google Play store, is
the "application id". The package that is used in your source code to
refer to your R class, and to resolve any relative activity/service
registrations, continues to be called the "package".
Related
I am working on one of my flutter project and trying to add firebase phone authentication but I encountered with the error related to safetynet.Whereas i am able to use other authentication methods e.g. SignInWithEmailAndPassword. Whenever I am calling my phoneLogin function i am getting the error. I have already installed google play service on my emulator.
CODE
Future phoneLogin(String phone) async {
BuildContext context;
try {
await auth.verifyPhoneNumber(
phoneNumber: '+91$phone',
timeout: const Duration(seconds: 30),
verificationCompleted: (PhoneAuthCredential credentials) async {
await auth.signInWithCredential(credentials);
},
verificationFailed: (FirebaseAuthException exception) {},
codeSent: (String verificationId, [int forcedResendingToken]) {
// print('1')
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => OtpPage(phone: phone),
),
);
},
codeAutoRetrievalTimeout: (String abc) {});
return null;
} catch (e) {
return null;
}
}
ERROR
E/zzbf ( 6483): SafetyNet Attestation fails basic integrity.
I/zzkn ( 6483): Provider GmsCore_OpenSSL not available
W/System ( 6483): Ignoring header X-Firebase-Locale because its value was null.
D/AndroidRuntime( 6483): Shutting down VM
E/AndroidRuntime( 6483): FATAL EXCEPTION: main
E/AndroidRuntime( 6483): Process: com.oneobit.greenobit, PID: 6483
E/AndroidRuntime( 6483): java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/browser/customtabs/CustomTabsIntent$Builder;
E/AndroidRuntime( 6483): at com.google.firebase.auth.internal.RecaptchaActivity.zza(com.google.firebase:firebase-auth##20.0.2:13)
E/AndroidRuntime( 6483): at com.google.android.gms.internal.firebase-auth-api.zztw.zzb(com.google.firebase:firebase-auth##20.0.2:7)
E/AndroidRuntime( 6483): at com.google.android.gms.internal.firebase-auth-api.zztw.onPostExecute(Unknown Source:2)
E/AndroidRuntime( 6483): at android.os.AsyncTask.finish(AsyncTask.java:771)
E/AndroidRuntime( 6483): at android.os.AsyncTask.access$900(AsyncTask.java:199)
E/AndroidRuntime( 6483): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
E/AndroidRuntime( 6483): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 6483): at android.os.Looper.loop(Looper.java:223)
E/AndroidRuntime( 6483): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime( 6483): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 6483): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime( 6483): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/AndroidRuntime( 6483): Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.browser.customtabs.CustomTabsIntent$Builder" on path: DexPathList[[zip file "/data/app/~~VMK8TkW9ozBJD9t7dnRn8g==/com.oneobit.greenobit-EtKxl5CBj6rDZiliq4I1ZQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~VMK8TkW9ozBJD9t7dnRn8g==/com.oneobit.greenobit-EtKxl5CBj6rDZiliq4I1ZQ==/lib/x86, /data/app/~~VMK8TkW9ozBJD9t7dnRn8g==/com.oneobit.greenobit-EtKxl5CBj6rDZiliq4I1ZQ==/base.apk!/lib/x86, /system/lib, /system_ext/lib]]
E/AndroidRuntime( 6483): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
E/AndroidRuntime( 6483): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime( 6483): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime( 6483): ... 12 more
I/Process ( 6483): Sending signal. PID: 6483 SIG: 9
Lost connection to device.
I have already updated SHA256 key to my Firebase console.
Firebase have updated certain things one of them is they have included captcha verification before sending the code or OTP to mobile devices.
To solve this issue see bellow:
add the following to project/android/app/build.gradle
implementation "androidx.browser:browser:1.3.0"
add this in the dependencies section ...
dependencies {
implementation "androidx.browser:browser:1.3.0"
///
}
you can find the latest version here: android browser .
REASON:
The app tries to verify the captcha and send the code, for that it tries to launch a browser but because of the missing implementation it fails to load a browser and crashes the application.
I'm fairly new to Flutter and haven't ever used Firebase before so my aplogies if there is an obvious solution to this.
I'm working on a Flutter app which involves recording form submissions and submitting them to a central location.
Firebase Storage seemed like a good fit since as I understood it the app can upload files to the cloud bucket and then they can be accessed through the Firebase console. Correct me if I'm wrong.
So I found this module for Flutter;
https://pub.dartlang.org/packages/firebase_storage
I used the example code as a basis.
once at the start of the code I call;
final FirebaseApp app = await FirebaseApp.configure(
name: 'test',
options: new FirebaseOptions(
googleAppID: Platform.isIOS
? '{ios app id}'
: '{android app ID}',
gcmSenderID: '{project number code}',
apiKey: '{web api key from the firebase console}',
projectID: '{project ID}',
),
);
storage = new FirebaseStorage(
app: app, storageBucket: '{address to data bucket}');
Then to upload a file I've tried;
final StorageReference ref =
storage.ref().child('uploads').child(filename);
final StorageUploadTask uploadTask = ref.putFile(
file,
new StorageMetadata(
contentLanguage: 'en',
customMetadata: <String, String>{'activity': 'submission'},
),
);
final Uri downloadUrl = (await uploadTask.future).downloadUrl;
final http.Response downloadData = await http.get(downloadUrl);
final String name = await ref.getName();
final String bucket = await ref.getBucket();
final String path = await ref.getPath();
return downloadData.statusCode >= 200 && 299 >= downloadData.statusCode;
and in the Firebase console I created the Uploads folder and I think set everything else up correctly.
My Firebase storage access rules look like this;
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
My issue is that when I try to upload the file I get the following error;
W/DynamiteModule(25832): Local module descriptor class for com.google.android.gms.firebasestorage not found.
I/DynamiteModule(25832): Considering local module com.google.android.gms.firebasestorage:0 and remote module com.google.android.gms.firebasestorage:6
I/DynamiteModule(25832): Selected remote version of com.google.android.gms.firebasestorage, version >= 6
W/System (25832): ClassLoader referenced unknown path: /data/data/com.google.android.gms/app_chimera/m/00000040/n/armeabi-v7a
W/System (25832): ClassLoader referenced unknown path: /data/data/com.google.android.gms/app_chimera/m/00000040/n/armeabi
E/StorageUtil(25832): error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
W/NetworkRequest(25832): no auth token for request
E/StorageException(25832): StorageException has occurred.
E/StorageException(25832): User does not have permission to access this object.
E/StorageException(25832): Code: -13021 HttpResult: 403
E/StorageException(25832): The server has terminated the upload session
E/StorageException(25832): java.io.IOException: The server has terminated the upload session
E/StorageException(25832): at com.google.firebase.storage.UploadTask.zzs(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.UploadTask.zzr(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.UploadTask.run(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.StorageTask.zzl(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.zzq.run(Unknown Source)
E/StorageException(25832): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
E/StorageException(25832): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
E/StorageException(25832): at java.lang.Thread.run(Thread.java:818)
E/StorageException(25832): Caused by: java.io.IOException: { "error": { "code": 403, "message": "Permission denied. Could not perform this operation" }}
E/StorageException(25832): at bha.a(:com.google.android.gms.dynamite_dynamitemodulesc#12685022#12.6.85 (040308-197041431):147)
E/StorageException(25832): at bha.a(:com.google.android.gms.dynamite_dynamitemodulesc#12685022#12.6.85 (040308-197041431):119)
E/StorageException(25832): at bgu.onTransact(:com.google.android.gms.dynamite_dynamitemodulesc#12685022#12.6.85 (040308-197041431):7)
E/StorageException(25832): at android.os.Binder.transact(Binder.java:387)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zza.transactAndReadExceptionReturnVoid(Unknown Source)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zzm.zzf(Unknown Source)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zzq.zza(Unknown Source)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zzf.zza(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.UploadTask.zzc(Unknown Source)
E/StorageException(25832): ... 6 more
E/StorageException(25832): StorageException has occurred.
E/StorageException(25832): User does not have permission to access this object.
E/StorageException(25832): Code: -13021 HttpResult: 403
E/StorageException(25832): The server has terminated the upload session
E/StorageException(25832): java.io.IOException: The server has terminated the upload session
E/StorageException(25832): at com.google.firebase.storage.UploadTask.zzs(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.UploadTask.zzr(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.UploadTask.run(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.StorageTask.zzl(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.zzq.run(Unknown Source)
E/StorageException(25832): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
E/StorageException(25832): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
E/StorageException(25832): at java.lang.Thread.run(Thread.java:818)
E/StorageException(25832): Caused by: java.io.IOException: { "error": { "code": 403, "message": "Permission denied. Could not perform this operation" }}
E/StorageException(25832): at bha.a(:com.google.android.gms.dynamite_dynamitemodulesc#12685022#12.6.85 (040308-197041431):147)
E/StorageException(25832): at bha.a(:com.google.android.gms.dynamite_dynamitemodulesc#12685022#12.6.85 (040308-197041431):119)
E/StorageException(25832): at bgu.onTransact(:com.google.android.gms.dynamite_dynamitemodulesc#12685022#12.6.85 (040308-197041431):7)
E/StorageException(25832): at android.os.Binder.transact(Binder.java:387)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zza.transactAndReadExceptionReturnVoid(Unknown Source)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zzm.zzf(Unknown Source)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zzq.zza(Unknown Source)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zzf.zza(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.UploadTask.zzc(Unknown Source)
E/StorageException(25832): ... 6 more
Is it possible to log in with an app account (service account?) so individual users do not need to log in?
What am I doing wrong here?
Quoting from your StorageException:
User does not have permission to access this object.
This is what you would expect because your rules state the following:
allow read, write: if request.auth != null;
Firebase uses authentication.
There are two options to solve this:
Either you authenticate your users with Firebase using the firebase_auth plugin
Or you make your files publicly available by changing your rules to allow read, write;
The Storage Rules documentation contains information about integrating Firebase Authentication.
I am trying to login with Twitter when i used dependency firebase_auth:^0.6.6 it was working perfactly and i fetch the user's Profile picture and the Code was
final TwitterLoginResult result = await twitterLogin.authorize();
switch (result.status)
{
case TwitterLoginStatus.loggedIn:
var session = result.session;
FirebaseUser user = await _auth.signInWithTwitter(
authToken: session.token, authTokenSecret: session.secret);
img=user.photoUrl;
}
but i migrated the app to AndroidX and this dependency was not compatible so i used firebase_auth: ^0.14.0+5 and this code was not working so i change the code to
final TwitterLoginResult result = await twitterLogin.authorize();
switch (result.status) {
case TwitterLoginStatus.loggedIn:
var session = result.session;
final AuthCredential credential =
TwitterAuthProvider.getCredential(authToken: session.token,
authTokenSecret: session.secret);
FirebaseUser user = (await _auth.signInWithCredential(credential)).user;
and this code is not working app is Crashing and showing the error
W/BiChannelGoogleApi(18829): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzak#70a4ccf
W/InputMethodManager(18829): startInputReason = 1
D/FirebaseAuth(18829): Notifying id token listeners about user ( D71yiiEX7ubSon4xxcddKlSydn72 ).
D/FirebaseAuth(18829): Notifying auth state listeners about user ( D71yiiEXccccccccKlSydn72 ).
I/zygote64(18829): Do full code cache collection, code=124KB, data=91KB
I/zygote64(18829): After code cache collection, code=123KB, data=68KB
I/zygote64(18829): Do partial code cache collection, code=123KB, data=68KB
I/zygote64(18829): After code cache collection, code=123KB, data=68KB
I/zygote64(18829): Increasing code cache capacity to 512KB
D/AndroidRuntime(18829): Shutting down VM
E/AndroidRuntime(18829): FATAL EXCEPTION: main
E/AndroidRuntime(18829): Process: com.example.login_app, PID: 18829
E/AndroidRuntime(18829): java.lang.IllegalArgumentException: Unsupported value: null
E/AndroidRuntime(18829): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:294)
E/AndroidRuntime(18829): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:291)
E/AndroidRuntime(18829): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:291)
E/AndroidRuntime(18829): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:291)
E/AndroidRuntime(18829): at io.flutter.plugin.common.StandardMethodCodec.encodeSuccessEnvelope(StandardMethodCodec.java:57)
E/AndroidRuntime(18829): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:225)
E/AndroidRuntime(18829): at io.flutter.plugins.firebaseauth.FirebaseAuthPlugin$SignInCompleteListener.onComplete(FirebaseAuthPlugin.java:691)
E/AndroidRuntime(18829): at com.google.android.gms.tasks.zzj.run(Unknown Source:4)
E/AndroidRuntime(18829): at android.os.Handler.handleCallback(Handler.java:808)
E/AndroidRuntime(18829): at android.os.Handler.dispatchMessage(Handler.java:101)
E/AndroidRuntime(18829): at android.os.Looper.loop(Looper.java:166)
E/AndroidRuntime(18829): at android.app.ActivityThread.main(ActivityThread.java:7529)
E/AndroidRuntime(18829): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(18829): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
E/AndroidRuntime(18829): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
I/Process (18829): Sending signal. PID: 18829 SIG: 9
Lost connection to device.
Please can someone explain to me how to resolve this problem?
Problem is with login task AND Androidx twitter_login_issue
Add this dependency in your pubspec.yaml file and let me know this working or not?
flutter_twitter_login:
git: git://github.com/eudangeld/flutter_twitter_login.git
Same issue (question) login_issue
I am creating a logging system using firebase, i have connected my project to firebase and enabled
email and password authentication and added users. But when i run the app and try to login using the
email and password that i have added,it shows the below error and the app crashes.
class _AdminLoginState extends State<AdminLogin> {
String _username, _password;
final GlobalKey<FormState> _formkey = GlobalKey<FormState>();
Future<void> login() async{
final formState = _formkey.currentState;
if(formState.validate()){
formState.save();
try{
final FirebaseUser user = (await FirebaseAuth.instance.signInWithEmailAndPassword(email: _username, password: _password)).user;
Navigator.push(context, MaterialPageRoute(builder: (context) => Dashboard()));
}catch(e){
print(e.message);
}
}
}
}
when i enter the username and password the app shutdowns and throws me this error.
W/BiChannelGoogleApi(29343): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzak#4b54d30
E/JavaBinder(29343): *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
E/JavaBinder(29343): java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap;
E/JavaBinder(29343): at com.google.firebase.auth.internal.zzam.zzc(Unknown Source:22)
E/JavaBinder(29343): at com.google.firebase.auth.internal.zzam.zzde(Unknown Source:17)
E/JavaBinder(29343): at com.google.firebase.auth.api.internal.zzep.zza(Unknown Source:9)
E/JavaBinder(29343): at android.os.Binder.execTransact(Binder.java:735)
E/JavaBinder(29343): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.util.ArrayMap" on path: DexPathList[[zip file "/data/app/m20zero.adminbookingpage-tivSbYSPqm94eArdHgurKQ==/base.apk"],nativeLibraryDirectories=[/data/app/m20zero.adminbookingpage-tivSbYSPqm94eArdHgurKQ==/lib/arm64, /data/app/m20zero.adminbookingpage-tivSbYSPqm94eArdHgurKQ==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
E/JavaBinder(29343): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
E/JavaBinder(29343): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/JavaBinder(29343): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/JavaBinder(29343): ... 16 more
E/AndroidRuntime(29343): FATAL EXCEPTION: Binder:29343_1
E/AndroidRuntime(29343): Process: m20zero.adminbookingpage, PID: 29343
E/AndroidRuntime(29343): java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap;
E/AndroidRuntime(29343): at com.google.firebase.auth.internal.zzam.zzc(Unknown Source:22)
E/AndroidRuntime(29343): at com.google.firebase.auth.internal.zzam.zzde(Unknown Source:17)
E/AndroidRuntime(29343): at com.google.android.gms.internal.firebase_auth.zza.onTransact(Unknown Source:13)
E/AndroidRuntime(29343): at android.os.Binder.execTransact(Binder.java:735)
E/AndroidRuntime(29343): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.util.ArrayMap" on path: DexPathList[[zip file "/data/app/m20zero.adminbookingpage-tivSbYSPqm94eArdHgurKQ==/base.apk"],nativeLibraryDirectories=[/data/app/m20zero.adminbookingpage-tivSbYSPqm94eArdHgurKQ==/lib/arm64, /data/app/m20zero.adminbookingpage-tivSbYSPqm94eArdHgurKQ==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
E/AndroidRuntime(29343): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
E/AndroidRuntime(29343): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(29343): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(29343): ... 16 more
I/Process (29343): Sending signal. PID: 29343 SIG: 9
Lost connection to device.
'''
Did you change the minSdk version on build.gradle file?
I'm fairly new to Flutter and haven't ever used Firebase before so my aplogies if there is an obvious solution to this.
I'm working on a Flutter app which involves recording form submissions and submitting them to a central location.
Firebase Storage seemed like a good fit since as I understood it the app can upload files to the cloud bucket and then they can be accessed through the Firebase console. Correct me if I'm wrong.
So I found this module for Flutter;
https://pub.dartlang.org/packages/firebase_storage
I used the example code as a basis.
once at the start of the code I call;
final FirebaseApp app = await FirebaseApp.configure(
name: 'test',
options: new FirebaseOptions(
googleAppID: Platform.isIOS
? '{ios app id}'
: '{android app ID}',
gcmSenderID: '{project number code}',
apiKey: '{web api key from the firebase console}',
projectID: '{project ID}',
),
);
storage = new FirebaseStorage(
app: app, storageBucket: '{address to data bucket}');
Then to upload a file I've tried;
final StorageReference ref =
storage.ref().child('uploads').child(filename);
final StorageUploadTask uploadTask = ref.putFile(
file,
new StorageMetadata(
contentLanguage: 'en',
customMetadata: <String, String>{'activity': 'submission'},
),
);
final Uri downloadUrl = (await uploadTask.future).downloadUrl;
final http.Response downloadData = await http.get(downloadUrl);
final String name = await ref.getName();
final String bucket = await ref.getBucket();
final String path = await ref.getPath();
return downloadData.statusCode >= 200 && 299 >= downloadData.statusCode;
and in the Firebase console I created the Uploads folder and I think set everything else up correctly.
My Firebase storage access rules look like this;
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
My issue is that when I try to upload the file I get the following error;
W/DynamiteModule(25832): Local module descriptor class for com.google.android.gms.firebasestorage not found.
I/DynamiteModule(25832): Considering local module com.google.android.gms.firebasestorage:0 and remote module com.google.android.gms.firebasestorage:6
I/DynamiteModule(25832): Selected remote version of com.google.android.gms.firebasestorage, version >= 6
W/System (25832): ClassLoader referenced unknown path: /data/data/com.google.android.gms/app_chimera/m/00000040/n/armeabi-v7a
W/System (25832): ClassLoader referenced unknown path: /data/data/com.google.android.gms/app_chimera/m/00000040/n/armeabi
E/StorageUtil(25832): error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
W/NetworkRequest(25832): no auth token for request
E/StorageException(25832): StorageException has occurred.
E/StorageException(25832): User does not have permission to access this object.
E/StorageException(25832): Code: -13021 HttpResult: 403
E/StorageException(25832): The server has terminated the upload session
E/StorageException(25832): java.io.IOException: The server has terminated the upload session
E/StorageException(25832): at com.google.firebase.storage.UploadTask.zzs(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.UploadTask.zzr(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.UploadTask.run(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.StorageTask.zzl(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.zzq.run(Unknown Source)
E/StorageException(25832): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
E/StorageException(25832): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
E/StorageException(25832): at java.lang.Thread.run(Thread.java:818)
E/StorageException(25832): Caused by: java.io.IOException: { "error": { "code": 403, "message": "Permission denied. Could not perform this operation" }}
E/StorageException(25832): at bha.a(:com.google.android.gms.dynamite_dynamitemodulesc#12685022#12.6.85 (040308-197041431):147)
E/StorageException(25832): at bha.a(:com.google.android.gms.dynamite_dynamitemodulesc#12685022#12.6.85 (040308-197041431):119)
E/StorageException(25832): at bgu.onTransact(:com.google.android.gms.dynamite_dynamitemodulesc#12685022#12.6.85 (040308-197041431):7)
E/StorageException(25832): at android.os.Binder.transact(Binder.java:387)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zza.transactAndReadExceptionReturnVoid(Unknown Source)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zzm.zzf(Unknown Source)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zzq.zza(Unknown Source)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zzf.zza(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.UploadTask.zzc(Unknown Source)
E/StorageException(25832): ... 6 more
E/StorageException(25832): StorageException has occurred.
E/StorageException(25832): User does not have permission to access this object.
E/StorageException(25832): Code: -13021 HttpResult: 403
E/StorageException(25832): The server has terminated the upload session
E/StorageException(25832): java.io.IOException: The server has terminated the upload session
E/StorageException(25832): at com.google.firebase.storage.UploadTask.zzs(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.UploadTask.zzr(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.UploadTask.run(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.StorageTask.zzl(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.zzq.run(Unknown Source)
E/StorageException(25832): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
E/StorageException(25832): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
E/StorageException(25832): at java.lang.Thread.run(Thread.java:818)
E/StorageException(25832): Caused by: java.io.IOException: { "error": { "code": 403, "message": "Permission denied. Could not perform this operation" }}
E/StorageException(25832): at bha.a(:com.google.android.gms.dynamite_dynamitemodulesc#12685022#12.6.85 (040308-197041431):147)
E/StorageException(25832): at bha.a(:com.google.android.gms.dynamite_dynamitemodulesc#12685022#12.6.85 (040308-197041431):119)
E/StorageException(25832): at bgu.onTransact(:com.google.android.gms.dynamite_dynamitemodulesc#12685022#12.6.85 (040308-197041431):7)
E/StorageException(25832): at android.os.Binder.transact(Binder.java:387)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zza.transactAndReadExceptionReturnVoid(Unknown Source)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zzm.zzf(Unknown Source)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zzq.zza(Unknown Source)
E/StorageException(25832): at com.google.android.gms.internal.firebase_storage.zzf.zza(Unknown Source)
E/StorageException(25832): at com.google.firebase.storage.UploadTask.zzc(Unknown Source)
E/StorageException(25832): ... 6 more
Is it possible to log in with an app account (service account?) so individual users do not need to log in?
What am I doing wrong here?
Quoting from your StorageException:
User does not have permission to access this object.
This is what you would expect because your rules state the following:
allow read, write: if request.auth != null;
Firebase uses authentication.
There are two options to solve this:
Either you authenticate your users with Firebase using the firebase_auth plugin
Or you make your files publicly available by changing your rules to allow read, write;
The Storage Rules documentation contains information about integrating Firebase Authentication.