Firebase something went wrong flutter - flutter

I'm new to coding and I'm trying to create a login page with Firebase but the problem is that when I put my email + my password I have this message that appears:
W/System (30113): Ignoring header X-Firebase-Locale because its value was null.
D/FirebaseAuth(30113): Notifying id token listeners about user ( gZ4NEwxh0qRRl32ypTGvqgX6kJx2 ).
I connected Firebase to my application and I put the authentication by mail, I added the sha1 and the sha-256.

I see nothing wrong with that. Most importantly, you can log into your account.
If you think Ignoring header X-Firebase-Locale because its value was null. should be removed, I suggest you take a look at this answer:
PREPARATION
Check if your emulator has the permission to access internet and also is connected to.
Email/Password Sign-in method in your firebase console is enabled to gain access.
STEP 1: Create sha1 key + debug key information + Adding firebase. You probably have your sha1 key only with the normal
information from the release key, I guess?
STEP 2: Activate Android Device Verification from console.cloud.google.com and insert your sha keys that are
automatically generated by firebase + their matching preferences
(like package name...)
CONCLUSION
Your code looks good to me! Everything is set up right. I think you
forgot some trivial settings or the right sha key.

Related

Firebase sendPasswordResetEmail never completes

I'm trying to send a password reset email with firebase but it doesn't work. It doesn't throw any exceptions either. It just never completes, and I see no errors in the console. I tried debugging it and I saw that the parameter action code is null, is it supposed to be? All guides covering this don't add any action codesettings. I've tried signing out the user first but that doesn't seem to work. What to do?
This await firebaseAuth.sendPasswordResetEmail(email: currentEmail); is nested in a try-catch block that's all.
Console output:
W/System ( 757): Ignoring header X-Firebase-Locale because its value was null.
I/System.out( 757): isEmailSend:POST
I/System.out( 757): port:443
D/GraphicBuffer( 757): register, handle(0x8240d540) (w:720 h:1504 s:720 f:0x1 u:f02)
I/System.out( 757): Check isMmsSendPdu
I/System.out( 757): [OkHttp] sendRequest<<
This is all I see. The future just never completes.
Firstly i was stuck too in this while doing my first attempt.I realized i didn't activated resetpassword method on firebase console authetication.
After this i got same result because while trying with email doesn't exist on firebase console user panel that mail adress.
My suggestion check turn on password reset method on console and try it with exist email user. and be sure you don't try with null in email
all of that if doesn't work maybe it can be about the port settings.
And one more try change this
firebaseAuth.sendPasswordResetEmail(email: currentEmail)
to
firebaseAuth.sendPasswordResetEmail(currentEmail)
Please check if your emulator is connected to the internet. Sometimes the wifi is on but does not connected to the internet.
and also make sure you email/password sign-in method on firebase is enabled
and if that doesn't work then add this line: android:usesCleartextTraffic="true" to your android > app > src > main > AndroidMaifest.xml

Google Signin for Unity (Windows standalone build) - invalidGoogleToken when used with Playfab

Hopefully someone can point me in the right direction here, I'm attempting to log into Playfab using a google auth code retrieved from an async call in Unity, the flow is as follows:
Click my login to google button in Unity.
Unity begins to listen for the response and opens a google login browser session.
User clicks email/signs into email they want.
This response is returned to Unity with an auth code.
I have then attempted to use the returned google auth code with playfabs LoginWithGoogleAccount method":
PlayFabClientAPI.LoginWithGoogleAccount(new LoginWithGoogleAccountRequest()
{
TitleId = PlayFabSettings.TitleId,
ServerAuthCode = returnedWindowsGoogleAuthCode,
CreateAccount = true,
}, OnPlayfabGooglePlayAuthComplete, OnPlayfabGooglePlayAuthFailed);
This then fails with a returned response from playfab with "invalidGoogleToken".
From what I've read from what I've come across on google is that this token is possibly in a "used" state by the time I am calling LoginWithGoogleAccount and I possibly need a refreshed token? but I am not too familiar with the Google API so I could be completely off the mark there? But if this is the case what should I do here? How do I re-request a valid token without going back to the browser to do the same thing again?
To give you an idea of pretty much the exact code I'm looking at but I've altered slightly to get it to work in Unity I am following the Google Sample OAuthDesktopApp code:
OAuthDesktopApp Sample Code
I am calling the method "button_Click", this runs and makes the request, Unity then begins listening for the google response at line 72 and the auth code is then output to logs at line 129.
This auth code output at line 129 is what I have then been passing back in to LoginWithGoogleAccount which then results in the failed "invalidGoogleToken", this does also then run a request for user information which does correctly return the name/email of the user you signed in with etc.
Just to add to my previous comments, if I remove the call to performCodeExchange line 132 (I read somewhere that at that point I am swapping the auth code for a token and thus the auth code will no longer work? I'm guessing here) and then if I call PlayFabClientAPI.LoginWithGoogleAccount with the auth code I am presented with:
PlayFabError error:
error.GetHashCode(): 2051826304
error.Error: InvalidGoogleToken
error.ErrorMessage: invalid_grant details: Missing code verifier.
error.ErrorDetails: null
Hopefully this may help someone guide me.
First thanks to those that replied to this, So I've managed to solve this after a comment from a Playfab mod, There appears to be no official way from Google to login using a standlone Unity build nor an official way to then login to Playfab using the same build method.
The solution I've used uses a modified Unity version of one of the Google samples from OAuth 2.0 for Mobile & Desktop Apps .
This will allow you to get the oauth code within Unity then you can pass this oauth code to Playfab for login, BUT Playfab has since deprecated the way to do this (which is silly if its the only solution) so you need to modifiy Playfabs SDK to include the accesstoken then you can use this to finally login.

ionic with phonegap-facebook-plugin: invalid hash key

It worked ok. I logged in with facebook.
After a while, i don´t know exactly the reason, when I try to login with facebook, it starts to show:
Invalid key hash. The key hash ..... does not match any stored key hashes. Configure your app key hashes at http://developers.facebook.com/apps/...
The hash key that is showing in the error message it´s not the hash key set in the developers facebook and had worked before. I tried to put this hash in the developers.facebook but does not work too.
After hours of research:
deleted the app in Facebook developers
remove cordova plugin from ionic project
Delete the file debug.keystore under C:\Users\yourUserName.android
Generate a new key with "keytools"
Create a new app on developers.facebook.com and add the new hash key
Then it started to work again.
But now, its showing me the same "invalid hash key" again :(
Any help?
Edited:
I deleted just the debug.keystore and ran "ionic run android".
Then showed me the same error but with a new hash key,
I tryeid again to put the hash key that they show in the error message and it is working now. But it´s very strange, because the hash key that I generated with "keytools" and put in developer.facebook for the first time, was just for nothing.
I follow this tutorial: https://ionicthemes.com/tutorials/about/native-facebook-login-with-ionic-framework
Download APK (your_apk_name.apk)
Run Command keytool -list -printcert -jarfile your_apk_name.apk
Copy the SHA1 value
Go to http://tomeko.net/online_tools/hex_to_base64.php
paste SHA1 value & hit convert.
Copy the output(base64) and use this as your facebook hash.
You need to add all key hashes that you see in those error messages to the setting of your Facebook app. Go to developers.facebook.com/yourappid, to settings > basic, scroll down to key hashes and add it there. We've got 4 different hashes for ours now and I'm sure they'll be more going forward.
It seems that having other applications on the users phone that are using Facebook login can change the hash needed by your app in login. So like, if you've got the main Facebook app on your phone, it'll require a different hash for your app's login than if you have just Facebook Messenger. This is our working theory that holds up against all evidence so far.
I'd recommend setting up a logger for client errors so you can get those hashes as they pop up. This obviously isn't the ideal solution so I'd love to hear what others find out about this but, for now at least, it's working.

Facebook Plugin in for unity, key hash incorrect

Unity 5.3.0 Facebook Plugin 7.3.0
I am trying to log on to Facebook in my Unity app. I am doing a development build at this point and not a signed release build. In the editor, Facebook settings shows one Key hash value. When I build and run the app on the device, the login fails with the following message:
[ 01-05 15:32:12.551 6001: 6001 V/com.facebook.unity.FB ]
Exception during service
com.facebook.http.protocol.ApiException: [code] 404 [message]: Key hash DIFFERENT_KEY_HASH= does not match any stored key hashes.
sending to Unity OnLoginComplete({"error":"Invalid key hash. The key hash DIFFERENT_KEY_HASH= does not match any stored key hashes. Configure your app key hashes at http://developers.facebook.com/apps/12345678909876","callback_id":"1","key_hash":"DIFFERENT_KEY_HASH=\n"})
The key hash in the message is different from the one in the Unity editor. I had both key hashes added to the facebook developer's console. I still get the above error message.
Why are there two different key hash values, one displayed in the editor and one in the logcat? Is this a problem? Which one is correct? Why would this error continue even after the Facebook developer console has been updated?
Logcat's one is correct. I normally use to do this. That is put the editor Key Hash in Facebook app, then check the log, add that key hash too. :)
Double check your key hash (log's one).
Paste your log in answer too, if possible.
But my answer is the log's key hash should work.

Facebook Login using scribe

I'm using scribe to get user id, however I get this error:
OAuthConnectionException: There was a problem while creating a connection to the remote service.
I follow this example enhanced with javax filters (to get the parameter code correctly)
https://github.com/fernandezpablo85/scribe-java/blob/master/src/test/java/org/scribe/examples/FacebookExample.java
I also tried doing things manually and i got the access token which looks somehow like this ( i changed it a bit ) CAAHZCFE7YllgBAAZAenKbvZBrMZAZBkDGgydU2vAekwsM1V0StpZAgHXukEYWIDSpc5ZCXc4LB6suFeaPagcpj2ju6ayvAgrxYttvCQg9i7ZAdcF2ZCvhMNqTddsDUkNq1c1cX47U9KwutS5t6xpbV0cRabaVpgZCZAo4ZCTEtgckFmMajsb3zYWTH9LEfKj3CgcJ39lD2x1yRoXyAds0lKARmHZC
and while asking for user id like this:
https://graph.facebook.com/me?access_token=CAAHZCFE7YllgBAAZAenKbvZBrMZAZBkDGgydU2vAekwsM1V0StpZAgHXukEYWIDSpc5ZCXc4LB6suFeaPagcsj2ju6aYvYgrxYttvCQg9i7ZAdcF2ZCvhMNqTddsDUkNq1c1cX47U9KwutS5t6xpbV0cRabaVpgZCZAo4ZCTEtgckFmMajsb3zYWTH7LEfKj3CycJ39lD2x1yRoXyAds0lWLRmHZC%20,%20458856e03b909f426ec5d3791f0af466?fields=id,name
I get Malformed access token.
Do you have any suggestions regarding what I am doing wrong?
The URLs are the same, dunno what my mistake is :/