getting an error trying to authenticate to firebase with google provider - firebase

here's my website code snippet :
const provider = new firebase.auth.GoogleAuthProvider();
app.auth().signInWithRedirect(provider);
also tried
signInWithPopup(provider)
both results the same (signInWithPopup shows popup which immediately closes).
I get the same console error :
Uncaught TypeError: this.Zb.he is not a function
at Gg.toString (auth.js:136)
at Mg (auth.js:141)
at auth.js:140
at e.Da (auth.js:39)
at hd (auth.js:43)
at dd (auth.js:43)
at C.Zd (auth.js:42)
at Oc (auth.js:36)
this used to work fine until few days ago.
tried different browsers , same result.
also tried rolling back firebase npm version to 6.6.4
any help will be appreciated.

Eventually it was due to our project structure.
We used 2 different firebase js package versions so probably obfuscation was different between the two.
solved with some webpack configurations.
Thanks.

Related

Exports is not defined while using firestore

I am getting this error while using firestore in typescript -
exports is not defined
ReferenceError: exports is not defined
at eval (/node_modules/#firebase/firestore/dist/index.node.cjs.js?v=470e9090:5:23)
at instantiateModule (C:\Users\ADMIN\Desktop\game-store\node_modules\vite\dist\node\chunks\dep-713b45e1.js:66472:15)
I am using it with svelte kit.
I am following the docs on the firebase website and I think this error comes in getFirestore in onMount. this error happens sometimes and sometimes not.
Please help how to solve it!
I suspect there is a possible solution to your issue in a GitHub discussion I’ve found. They talk about incompatibility between firebase and svelte, but at the end someone commented this was an error caused by the imports. The comment is:
...Looks like when you import "#firebase/app" instead of "firebase/app" it works. Seems like Vite is unable to resolve "firebase/app" to "#firebase/app" because the firebase team said it actually points to "#firebase/app"...

same code but error on web version in flutter. Why?

in my flutter app when data adding from web version its shows error like this on mobile. but works fine on web, I use firebase as backend. why this is happening
Since web is transpiled to javascript, that has a type number (which receives both double and int). That problem maybe solved if you cast to right type.
You can learn more about how dart handles numbers in here:
https://dart.dev/guides/language/numbers

How do I fix ASAuthorization errors in Xcode 12 beta 6?

In the latest beta 6 of Xcode 12, I'm having errors popping up when trying to resume a SwiftUI preview. The main error appears to be Cannot find type 'ASAuthorizationAppleIDButton' in scope. The code compiles perfectly fine when building or running on the simulator, and no errors show up. Only when I try to run a preview do things not work. Other errors I see are:
Type 'SignInAppleButton' does not conform to protocol 'UIViewRepresentable'
Cannot find type 'ASAuthorizationControllerDelegate' in scope
Cannot find 'ASAuthorizationAppleIDProvider' in scope
Cannot find type 'ASAuthorization' in scope
I have import AuthenticationServices at the top of my files. An important note is that the same project works perfectly fine without any errors on Xcode 12 beta 1.
A short term solution I've found is to remove all code using ASAuth (subsequently Signin with Apple) and switching from Firebase CocoaPods to their new Firebase Swift package manager. This makes previews work. Prior to switching from CocoaPods, I would get strange linker errors after removing ASAuth code.
My assumption is that I need to implement SwiftUI's new Signin with Apple button, but I don't know how to use it based on the little documentation provided by Apple.
This is the site my code references almost exactly the same: https://www.alfianlosari.com/posts/building-authentication-in-swiftui-using-firebase-auth-sdk-and-sign-in-with-apple/

Firebase client on ReactNative

When using Firebase on ReactNative, it will show such error message:
can't find variable process
However, if I require firebase/lib/firebase-web.js manually, it will show:
can't find variable document
How can I resolve this?
I just went through the same issue while trying to use sockets.io in my react native app so hopefully I can help.
The reason that you cannot use firebase's node module is because there hasn't been a polyfill created yet for websockets support (which firebase is dependent on) in react native.
If you take a look at issue #619 in react native's repo you'll find the current discussion on creating a websockets api polyfill.
The way that we solved it is by using Jason's modified version of the sockets library and creating our own repo around just that file. Then we added the line below to our package.json dependencies.
"react-sockets": "crewapp/react-native-sockets-io"
The reason that Jason's version of the sockets.io client file works is because react-native is added as a user agent. You can find the code that makes this change at the top of the file:
window.navigator = {
userAgent: "react-native"
}
Once you've gone through these steps you should be able to require sockets.io / firebase as normal.
Just figuring it our. Pavan's answer is helpful, but it is not quite true when using with Firebase.
For firebase, please follow the steps:
Download the firebase-debug.js from wsExample. Or you can just install wsExample by npm and require the firebase-debug.js inside it.
Use badfortrains's forked React-Native:
"react-native": "git://github.com/badfortrains/react-native#WebSocket"
New the Firebase like this:
var firebase = require("../../firebase-debug.js");
var rootRef = new Firebase(Const.FB_ROOT);
Things should just work now!
I had issues with socket.io on React Native too, solution was to get notifications about new data and if data is big enough - get it by simple RESTfull request. in my case data was small enough to be sent all within notifications API.
I was using GCM service to send notification to phone from nodejs server. BTW, it uses less battery then socket connection and works great :)

Variable issue with urban airship

Titanium SDK version: 1.8.0.1
iPhone SDK version: 4.3
I am building an iOS app using Appcelerator. I try to setup push notifcations for Urban Airship using the official Appcelerator wiki guide: https://wiki.appcelerator.org/display/guides/Push+Notifications+with+Urban+Airship.
First I include the urbanairship.js file into the app.js file.
Ti.include('urbanairship.js');
Then I add these for lines (I replaced my tokens with XXX):
UrbanAirship.key='XXX';
UrbanAirship.secret ='XXX';
UrbanAirship.master_secret='XXX';
UrbanAirship.baseurl = 'https://go.urbanairship.com';
When I run the app in the simulator I get this error:
Script Error = Can't find variable: UrbanAirship at app.js (line 9).
What am I missing?
For anyone stumbling on this one,
You need to declare the variable 'UrbanAirship' before trying to assign values like key, secret, etc.
something like
var UrbanAirship = require('ti.urbanairship');
before typing in
UrbanAirship.key='XXX';
UrbanAirship.secret ='XXX';
UrbanAirship.master_secret='XXX';
UrbanAirship.baseurl = 'https://go.urbanairship.com';
The error message is quite straightforward. The system cannot find the variable because it is not defined.
PS - I believe 'Ti.include' is best used when trying to include .js files and not for modules.

Resources