-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add phone number sign-in #250
base: master
Are you sure you want to change the base?
Add phone number sign-in #250
Conversation
Thanks to @AVStarikovich! 😉 |
Please note that reCAPTCHA doesn't work inside Shadow DOM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be problematic. It means it needs something that has an id of a recaptcha-container
.
You can change this with saying...
signInWithPhoneNumber: function(phoneNumber, verifier) {
var appVerifier
if (verifier instanceof HTMLElement) {
appVerifier = verifier
} else if (typeof verifier === 'string') {
appVerifier = this.shadowRoot.querySelector('#recaptcha-container')
}
if (!appVerifier) return withError()
@tjmonsi Done. Only two questions:
createRecaptchaVerifier: function(container, parameters, app) {
return new firebase.auth.RecaptchaVerifier(container, parameters, app);
},
signInWithPhoneNumber: function(phoneNumber, applicationVerifier) {
return this._handleSignIn(this.auth.signInWithPhoneNumber(phoneNumber, applicationVerifier)
.then(function(confirmationResult) {
window.confirmationResult = confirmationResult;
}));
}, On the one hand, I believe we should keep PolymerFire API as close to Firebase JavaScript SDK API as possible. In the Firebase JavaScript SDK the |
You are right on point here. It will really need the user to create an application verifier. |
@tjmonsi The weekend has passed. Any news? |
I am stuck. Was working on the devfest site the whole weekend so that I can make a release today. Sorry If I have to ask for an extension :( |
@tjmonsi Any progress? |
I'm doing the issues and requests one by one :( I'll get into this tomorrow. Just got time to be free now |
Any progress? Will this feature get released anytime soon? |
Guys, don’t you think that we should discuss what we really want to accomplish here before reviewing the code itself? I’m asking because I’ve implemented phone auth myself in a Polymer app and I took completely different approach. Most concerning thing for me in the current PR is recreating recaptcha every time the function is being called. It can be done once, i.e. in a connected callback. |
So will this get released? |
I don’t think it should be released in the current state, but I’d love to continue working on this feature. As I’ve mentioned in the previous comment, it can be done cleaner. I won’t be able to make a PR with my approach until next month, I have a lot on my plate right now. |
Ping. |
Any progress? |
Copy-pasted from one of my projects: constructor: this._shadowHelper = document.createElement('div');
document.querySelector('body').appendChild(this._shadowHelper);
window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier(
this._shadowHelper,
{
size: 'invisible',
callback: () => this._recaptchaReady = true,
},
);
window.recaptchaWidgetId = await window.recaptchaVerifier.render(); Then you can use: grecaptcha.reset(window.recaptchaWidgetId); or
|
Fix #228.