-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support for PhoneNumber Auth #990
Comments
@prajwalgp We will be upgrading the SDK to 4.0 shortly. But AF does not wrap auth methods, instead you use the injected service to call out to the SDK. |
@davideast (Thanks for all the great tutorials) I have declared: I had initially instantiated this recaptcha var from inside the constructor() and got an error in the console: I moved the function to ngOnInit(){} and it all seems to work so far i.e. its displaying and the recaptcha component seems to work. Although this works it does not seem to be documented anywhere (for angularfire2) and secondly - why does it make a difference? Now... Currently I'm getting the 6 digit sms code however not quite sure what to do next, back to the docs. |
Ok, I'm all set and I can confirm I am now able to # via mobile from angular! I prefer the 'invisible' method, so I first put an empty div somewhere on my html page:
declared and inside ngOnInit() i have instantiated it:
The form submit function which is fired when the recaptcha is solved is:
Now in all of this, the only this that is causing me any issue now - is the inability to reset the recaptcha in code - , firebase web docs state I should be using: |
Hi all, Tried the following to reset the recaptcha, the definitions now show i.e. there are no errors highlighted, yet this fails with the notorious black screen displaying:
I've added various angular2 from NPM (Angular 2 Google reCaptcha)- Google reCaptcha but they don't expose a function that allows me to reset the reCaptcha with the widget id. this is essential to most and required for projects with phone auth enabled, and from what I can see there is no solution available yet. |
Hi All, Found the solution! now wherever you wish to use this variable declare it in your component.module.ts just after imports e.g.
whenever you call these Global's don't make the mistake of using I have tested this extensively (to the point where I received to following: NOTE: |
@Sagar-AppLogics Are you using this with ionic? Has it worked in browser or in real devices? because the recaptcha is not showing in real devices using ionic once I tried it |
for ionic, Guys just follow this tutorial https://javebratt.com/firebase-phone-authentication/ |
To save the click, as of 10 Aug 17, mkwsra's link does not work for ionic on devices. Same problem with the recapthca requirement on firebase phone auth. Still looking for the answer myself....... |
I was also getting the similar error when using grecaptcha and then used the way you described. |
Hi @Faisal0sal - Im not using ionic, I have tried of mobile device and desktop browsers successfully. Hi @Abby3017 - the best explanation I could have given without talking too much about my assumptions - for they are just that but as your asking, I'll try my best. From my understanding the firebase SDK includes grecaptcha. This is a global variable in a normal javascript environment. AngularFire2 is a wrapper around that firebase SDK, however, the nature of angular means that it is not possible to access the grecaptcha variable from within a component. So to make Angular "aware" of grecaptcha install the types definition, this will aid in code completion and compilation. You must declare grecaptcha as a variable to remove any errors. You must also access it not via this.grecaptcha..... but just grecaptcha. To understand this properly - you must understand how the SDK exposes functions and their scope, and how the AngularFire2 wrapper exposes to Angular + scope, not to forget how Angular itself actually works and isolates javascript between components. |
Thanks for your insight @Sagar-AppLogics and I studied about them. It would be great help if you can provide any material to look how library like angularfire2 wrap around angular and exposes the variable. |
hi i am doing phone number auth with ionic and i want to remove recaptcha . |
@TKlarissa You can use the firebase native plugin to achieve the phone number authentication. |
Version info
**Angular: 2.2.1
**Firebase: 4.0.0
**AngularFire: 2.0.0-beta.7-pre
**Ionic : 2.0.1
Angular Fire Support for Firebase PhoneNumber Auth Provider for Authentication
The text was updated successfully, but these errors were encountered: