Comments (5)
Hello @alkahtani ,
First, sorry about, but we don’t have web implementation on this plugin, yet. But the error suggests that you are not initializing your Firebase App.
Please, follow the instructions of Add Firebase SDKs and initialize Firebase on official docs.
Don’t forget, after that, you will need to test on a phone or emulator.
Best regards,
Bernardo Baumblatt
from capacitor-firebase-auth.
Dear @baumblatt ,
Thank you so much for you effort to write this awesome plugin. My task is implement phone auth on both android and ios. I have followed your instruction. Unfortunately, I also received above error message from debug area in Xcode(ios), yet I haven't tried on android.
Code
cfaSignIn('phone', {"phone": "+85516827282"}).subscribe(
user => console.log(user.phoneNumber)
);
Error
[error] - ERROR {"code":"auth/argument-error","message":"Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp()."}
I'm so glad if you could help.
Cheer,
Afril TEP
from capacitor-firebase-auth.
Hi everyone!
I managed to make it work now by:
1. Implementing javascript initialization from firebase. Here is the snippet:
import { Component, OnInit } from '@angular/core';
import * as firebase from 'firebase';
import {cfaSignIn} from 'capacitor-firebase-auth';
@Component({
selector: 'app-register',
templateUrl: './register.page.html',
styleUrls: ['./register.page.scss'],
})
export class RegisterPage implements OnInit {
constructor(
) {
let firebaseConfig = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "",
measurementId: ""
};
firebase.initializeApp(firebaseConfig);
}
onSubmit() {
cfaSignIn('phone', {"phone": "+85516827282"}).subscribe(
user => console.log(user.phoneNumber)
);
}
}
2. Add a URL scheme to my app:
Here is their official instruction: Url Scheme
Please take a look at screenshot:
from capacitor-firebase-auth.
I am trying to use phone authentication, but I have not been successful.
I started a blank project at Ionic Angular with Capacitor and ran folow commands:
npm install --save capacitor-firebase-auth
npx cap sync
npm install jetifier
npx jetifier
npm install --save @capacitor/core
npm install --save firebase (I installed peerdependencies myself)
my capacitor.config.json seems like:
"CapacitorFirebaseAuth": {
"providers": ["phone"],
"languageCode": "en",
"nativeAuth": false,
"permissions": {}
}
I followed instructions to install firebase on Android and put google-services.json file on Android/App.
When I tray execute de code on my login.page.ts:
cfaSignIn('phone', {phone: '+55'+phoneNumer}).subscribe(user => { console.log(user.phoneNumber); });
I receved the error:
Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().
I think de library was waiting for firebase.initializeApp() at web layer, but I'm using Capacitor. Should I instantiate firebase.initializeApp()? (in firebase console I create only a Android config, for use firebase.initializeApp() I will need create a Web config too). How capacitor-firebase-auth phone authentication works? Native layer (Android project) or web layer (javascript)? How to make a simple ionic capacitor app login with phone authentication?
from capacitor-firebase-auth.
the solution is:
Instead of use cfaLogIn('phone', {phone: '+55'+phoneNumber}).subscribe(user => { console.log(user.phoneNumber); });
I should use cfaSignInPhone('+55'+phoneNumber).subscribe(user => { console.log(user.phoneNumber); });
from capacitor-firebase-auth.
Related Issues (20)
- Solution of Instance of firebase.auth.Auth must be passed as an argument
- "CapacitorFirebaseAuth" plugin is not implemented on android HOT 1
- sign in with apple and getting other info such as email, phone
- Error Accessing App We're sorry, but the application you're trying to use doesn't exist or has been disabled.
- Firebase Emulator support
- cito firebase login
- Don't skip showing choose account modal HOT 1
- Step 2 Issues HOT 1
- iOS Troubles (Works on Android + Web), Subscription never completes
- iOS Sign in not Persisting
- Appstore Review: Cannot contact reCAPTCHA HOT 1
- appDelegate.swift facebook usage HOT 1
- Firebase 8 ➡️ 9 HOT 4
- FBSDKCoreKit not compiling HOT 4
- Possible bug on phone auth HOT 5
- Get access token Google
- SAML over Microsoft Azure AD integration HOT 1
- Phone Verification failed on modern Android HOT 1
- firebase import path change
- Deprecate and Point to @capacitor-firebase/authentication ??
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from capacitor-firebase-auth.