Firebase UI Auth - email-link android Intent not passing data - firebase

I have configured everything for email-link authentication as FirebaseUI Auth guide states. It works on iOS, which means most of the Firebase Console configuration should be ok.
On Android, however, when I click on the link I get in my inbox, it gets me to the app, but the Intent is MAIN/LAUNCHER with no data whatsoever, so it's not being recognised by Firebase Auth and nothing happens (AuthUI.canHandleIntent returns false). Has anyone had a similar problem?
I have tried setting the ActionCodeSettings url and configuring a deep link on Firebase console as plain "MYDOMAIN.page.link" as well as "MYDOMAIN.page.link/xxxx" and nothing works.
Android Manifest has
<data android:host="MYDOMAIN.page.link" android:scheme="https"/>
as well as
<data android:host="MYPROJECTID.firebaseapp.com" android:scheme="https"/>
configured.
Nothing works.
Both MYPROJECTID.firebaseapp.com and MYDOMAIN.page.link are whitelisted in the Auth Authorised Domains in Firebase Console.

Related

Firebase Google sign error: This domain is not authorized to run this operation

I just deploy my react app to firebase , after deployment I am having trouble getting the Firebase Google sign-in to work and got the error :"This domain (*********.web.app) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab."
see the error in below pic:
See This
also I've whitelist the domain and add it to authentication tab
See This
,but don't know why I still got the error. Can Anyone help me with this issue?
This problem is likely due to the sign-in methods that are enabled. In the firebase console, you need to enable the Google sign-in method

Couldn't find my Api-key in my firebase console for my flutter project sign-up authentication

I'm new to flutter and trying to implement sign-up authentication in flutter using Firebase. But the problem is that when i learned about authentication, they provided a post method url which must accept API-KEY in it.
Now, i dont know where does my API-KEY exists.
http.post(https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupNewUser?key=[API-KEY]');
You'll find it in Project Settings under the General tab.
If you add a web app, it's also the first parameter in the config.

Firebase Authentication partially working (only email)

After months of developing a Web App under Firebase suddenly these days we have a problem with the Authentication, it returns this console.alert only with Facebook and google login (email/pass login works fine):
[firebase-auth] Info: The current domain is not authorized for OAuth
operations. This will prevent signInWithPopup, signInWithRedirect,
linkWithPopup and linkWithRedirect from working. Add your domain
(front.qualify.mx) to the OAuth redirect domains list in the Firebase
console -> Auth section -> Sign in method tab.
The App uses 3 different sub-domains, and in all 3 we can access over email/pass but not Facebook nor google.
We tried updating the Firebase initialization script, nothing. We have checked the API keys (in the Google APIs Credentials) and there was a new "Server key (auto created by Google Service)" which no one told us it was generated (Jan. 18th), so we edited it to include the domains as the original API key in different ways (w/wo * and /*), nothing. We deleted this new Server Key, suddenly something different, now the console includes a 403 error before the alert stated above and returns auth/timeout code inside the object.
We also found the Identity Toolkit API has detected many errors, so we tried to add the URLs for login, logout and email, but nothing happens when trying to save.
What are we missing?
The solution was adding my-app.firebaseapp.com (being my-app the unique identifier of our Firebase App) to the HTTP referrers in the Browser-Key Credentials from the Google APIs console and wait some time to propagate.
After many months of development the app never had a problem, and we are sure we never removed such referrer (if it was ever there).
Anyway... it's done and learned.
The simple way I was able to solve this issue I had with my ionic project was by following the instructions in the log, if you don't see any message try console log the response from firebase.
So what I simply did was follow the url: https://console.developers.google.com/apis/api/identitytoolkit.googleapis.com/overview?project='projectId'
*projectId = the Id of your project
and enable the Identity API something it brought up. Finish, and it worked instantly.

How to share Authentication token between app in Firebase 3.0?

In older version of Firebase we can obtain authenticated token for sharing between our app, extensions.
But when upgrade to Firebase 3.0, that function doesn't work anymore.
I've use getTokenWithCompletion: on FIRUser, then in my App Extension I call signInWithCustomToken:completion: with token i just obtained. But Firebase return an error with messgage:
Error Domain=FIRAuthErrorDomain Code=17000 "The custom token format is
incorrect. Please check the documentation." UserInfo=0x799b6010
{error_name=ERROR_INVALID_CUSTOM_TOKEN, NSLocalizedDescription=The
custom token format is incorrect. Please check the documentation.}
How to get authenticate token from FIRUser to re-authenticate it in my App Extension?
signInWithCustomToken is meant to be used with your own tokens minted on your own server (read more here).
The best way for you to bootstrap a session between different components of your application will be to, at sign-in time, share the user's credential and perform the bootstraping across all your components.
For example, if you are using Facebook login, when your retrieve the facebook access token, you would have to share it from your app to your extension, and then call signInWithCredential with the same token in both your main app and extension.
There is currently no way to sign in a user into a Firebase app with the v3.X SDKs from another Firebase app instance.
I had the same problem this morning when upgrading to the latest version of Firebase on Android.
To fix the problem I had to update the Firebase Server SDK to version 3.0+
This is a Java backend implementation, but the same applies for NodeJS as well.
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-server-sdk</artifactId>
<version>[3.0.0,)</version>
</dependency>
In the new Firebase Server SDK you have to initialize your Firebase app first using a generated JSON file.(Found under permissions in your new Firebase console) Then you can generate the JWT token.
FirebaseOptions options = new FirebaseOptions.Builder()
.setServiceAccount(new FileInputStream("path/to/json/file.json"))
.setDatabaseUrl("https://myapp.firebaseio.com/")
.build();
FirebaseApp.initializeApp(options);
String token = FirebaseAuth.getInstance().createCustomToken("userID");
A token generated this way worked allowed me to use the new signInWithCustomToken() method.
You can read more here: https://firebase.google.com/docs/auth/server
Hope this helps
I had the same error as the OP. I am assuming that you are using a service account email and private key during token generation on your server. The token my server generated was successful on http://jsfiddle.net/firebase/XDXu5/. However, my app would give the same error.
In the end, it turned out that I was signing it using "HS256" (which is what I was using in my existing token generation - pre firebase 3.0). When I changed it to "RS256" instead, the token generated works in the app.
Hope that helps.

Firebase: This domain is not authorized

I imported Firebase JS v3 API and used to initialize Firebase using:
firebase.initializeApp(config);
However the app failed to load correctly via web browser on localhost, resulting in the following error:
Error: This domain is not authorized for OAuth operations for your
Firebase project. Edit the list of authorized domains from the
Firebase console.
firebase.js:71:1333
I solved the problem by adding the localhost domain to OAuth redirect domains (within SETUP SIGN IN METHOD on the Auth tab of Firebase console).
in firebase console Auth --> Authorised domains
must equal (in Google cloud console -- > API & Services --> credentials ) :
must equal (in api config) :
Solution which worked for me after trying out all the options on the listed above and on other sites regarding using FireBase oAuth was the following:
login at https://console.cloud.google.com
Go to APIs & Services > Credentials
Once here, locate API Key you are using in your app that connects to FireBase
Now add your custom domain to HTTP Referrers
For android or ios or having your application on all three mediums, you will need to create API keys per medium.
Make sure the "authDomain" in your config matches the one in your firebase console. If you're running the app on localhost, make sure it's set to localhost and localhost exists on your firebase console.
Auth -> Sign In Method -> OAuth redirect domains
var config = {
apiKey: "...",
authDomain: "...", // this should match the one on your firebase console
databaseURL: "...",
storageBucket: "",
};
firebase.initializeApp(config);
Firebase Users
For me the source of the error was that the domain was not added in the firebase console.
Here is an image in the firebase console to add the custom domain for your website:
Firebase now has localhost as Authorized domains by default but if you are facing this for a custom domain, here is a quick solution.
Go to Google console Authentication tab > Settings > Authorized domains
Add your domain
(PS - About version, I'm using Firebase 9.9.3 on React.)
Problem Authorised domain Firebase Locahost OAUTH2
If you are using Google Chrome you can see a problem with the Identity Toolkit API
DISABLE. You need to enabled this API on the google cloud project to get OAUTH servcies in Firebase project.
https://console.developers.google.com/apis/api/identitytoolkit.googleapis.com/overview?project=project-id
For those having this issue in Heroku:
Make sure you keep the authDomain property with the same value you got from Firebase.
DO NOT change this to the current Heroku domain.
Not really specific to Android, but check the address in your actionCodeSettings.
actionCodeSettings.url must be correct and whitelisted.
Authenticate with Firebase Using Email Link in JavaScript
None of the above answers worked for me, as I already had localhost in Authorized domains list. For me the problem was incorrect API key, I must have somehow deleted one of the characters from it. I got a more descriptive (or rather - not misleading) error message when I changed to signInWithPopup to signInWithRedirect. Possibly the same problem might happen when the API key is expired.
None of the above solutions worked for me but this did.
Go to Google console Authentication tab > Sign In Method > Authorized Domains
Add 127.0.0.1
localhost was already in my Authorized Domains but in my case I needed to add 127.0.0.1 as well
The important point is.. you must add the yourprojectid.firebaseapp.com domain to the authorized domains.. not your real domain name. That worked for me.
I got this problem also and the domain was like this:
127.0.0.1:5173/
I just turned it into: localhost:5173 and it ran
without a problem.

Resources