window.FirebasePlugin.verifyPhoneNumber function response unable to use it
I have implemented firebase phone authentication mechanism to login user with following
code:
(<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) {
//alert("sms sent successfully"+ credential.verificationId);
//this.verificationId = credential.verificationId;
let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId});
modal.present();
}, error => {
alert(JSON.stringify(error));
console.log("error: " + error);
});
}
but credential.verificationId value can't able to store or send to another page
verify() {
this.signInCredential = firebase.auth.PhoneAuthProvider.credential(this.verificationId, this.code);
alert("u"+JSON.stringify(this.signInCredential));
firebase.auth().signInWithCredential(this.signInCredential).then((info) => { alert("check"+JSON.stringify(info));}, (error) => {
alert("err"+JSON.stringify(error));})
}
How to resolve above error?
android firebase ionic-framework ionic3 firebase-authentication
add a comment |
I have implemented firebase phone authentication mechanism to login user with following
code:
(<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) {
//alert("sms sent successfully"+ credential.verificationId);
//this.verificationId = credential.verificationId;
let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId});
modal.present();
}, error => {
alert(JSON.stringify(error));
console.log("error: " + error);
});
}
but credential.verificationId value can't able to store or send to another page
verify() {
this.signInCredential = firebase.auth.PhoneAuthProvider.credential(this.verificationId, this.code);
alert("u"+JSON.stringify(this.signInCredential));
firebase.auth().signInWithCredential(this.signInCredential).then((info) => { alert("check"+JSON.stringify(info));}, (error) => {
alert("err"+JSON.stringify(error));})
}
How to resolve above error?
android firebase ionic-framework ionic3 firebase-authentication
add a comment |
I have implemented firebase phone authentication mechanism to login user with following
code:
(<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) {
//alert("sms sent successfully"+ credential.verificationId);
//this.verificationId = credential.verificationId;
let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId});
modal.present();
}, error => {
alert(JSON.stringify(error));
console.log("error: " + error);
});
}
but credential.verificationId value can't able to store or send to another page
verify() {
this.signInCredential = firebase.auth.PhoneAuthProvider.credential(this.verificationId, this.code);
alert("u"+JSON.stringify(this.signInCredential));
firebase.auth().signInWithCredential(this.signInCredential).then((info) => { alert("check"+JSON.stringify(info));}, (error) => {
alert("err"+JSON.stringify(error));})
}
How to resolve above error?
android firebase ionic-framework ionic3 firebase-authentication
I have implemented firebase phone authentication mechanism to login user with following
code:
(<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) {
//alert("sms sent successfully"+ credential.verificationId);
//this.verificationId = credential.verificationId;
let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId});
modal.present();
}, error => {
alert(JSON.stringify(error));
console.log("error: " + error);
});
}
but credential.verificationId value can't able to store or send to another page
verify() {
this.signInCredential = firebase.auth.PhoneAuthProvider.credential(this.verificationId, this.code);
alert("u"+JSON.stringify(this.signInCredential));
firebase.auth().signInWithCredential(this.signInCredential).then((info) => { alert("check"+JSON.stringify(info));}, (error) => {
alert("err"+JSON.stringify(error));})
}
How to resolve above error?
android firebase ionic-framework ionic3 firebase-authentication
android firebase ionic-framework ionic3 firebase-authentication
edited Nov 17 '18 at 16:08
Phonolog
3,72231744
3,72231744
asked Nov 15 '18 at 12:27
suniel kalwanisuniel kalwani
224317
224317
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You should get the parameters from the nav params, directly it won't work.
try
constructor(public params: Navparams){
}
verify() {
let verificationId = params.get("verificationId");
this.signInCredential =
firebase.auth.PhoneAuthProvider.credential(verificationId, this.code);
alert("u"+JSON.stringify(this.signInCredential));
firebase.auth().signInWithCredential(this.signInCredential).then((info) =>
{
alert("check"+JSON.stringify(info));}, (error) => {
alert("err"+JSON.stringify(error));
})
}
i hope this will help you.
For your reference check this article
https://medium.com/@gbrigens/ionic-3-phone-authentication-with-firebase-dbed967e95ef
I am not able to jump to another screen using (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) { //alert("sms sent successfully"+ credential.verificationId); //this.verificationId = credential.verificationId; let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId}); modal.present(); }, error => { console.log("error: " + error); }); } because credential.verificationId value can't store in any variable
– suniel kalwani
Nov 19 '18 at 12:23
Are you getting any error while storing credential? and you are trying open a modal, is it opening?
– Ramesh Krishnan
Nov 19 '18 at 12:58
i am not getting any error but its showing undefined but when i alert( credential.verificationId) it showing a long string
– suniel kalwani
Nov 19 '18 at 13:09
@sunielkalwani you can store the credential in variables, i'm not understanding where you are getting undefined error?
– Ramesh Krishnan
Nov 19 '18 at 13:17
and instead of this.variable use let, var or constants to store credential, there is no restriction to store credential in a variable or any storage
– Ramesh Krishnan
Nov 19 '18 at 13:17
|
show 1 more comment
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53319513%2fwindow-firebaseplugin-verifyphonenumber-function-response-unable-to-use-it%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You should get the parameters from the nav params, directly it won't work.
try
constructor(public params: Navparams){
}
verify() {
let verificationId = params.get("verificationId");
this.signInCredential =
firebase.auth.PhoneAuthProvider.credential(verificationId, this.code);
alert("u"+JSON.stringify(this.signInCredential));
firebase.auth().signInWithCredential(this.signInCredential).then((info) =>
{
alert("check"+JSON.stringify(info));}, (error) => {
alert("err"+JSON.stringify(error));
})
}
i hope this will help you.
For your reference check this article
https://medium.com/@gbrigens/ionic-3-phone-authentication-with-firebase-dbed967e95ef
I am not able to jump to another screen using (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) { //alert("sms sent successfully"+ credential.verificationId); //this.verificationId = credential.verificationId; let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId}); modal.present(); }, error => { console.log("error: " + error); }); } because credential.verificationId value can't store in any variable
– suniel kalwani
Nov 19 '18 at 12:23
Are you getting any error while storing credential? and you are trying open a modal, is it opening?
– Ramesh Krishnan
Nov 19 '18 at 12:58
i am not getting any error but its showing undefined but when i alert( credential.verificationId) it showing a long string
– suniel kalwani
Nov 19 '18 at 13:09
@sunielkalwani you can store the credential in variables, i'm not understanding where you are getting undefined error?
– Ramesh Krishnan
Nov 19 '18 at 13:17
and instead of this.variable use let, var or constants to store credential, there is no restriction to store credential in a variable or any storage
– Ramesh Krishnan
Nov 19 '18 at 13:17
|
show 1 more comment
You should get the parameters from the nav params, directly it won't work.
try
constructor(public params: Navparams){
}
verify() {
let verificationId = params.get("verificationId");
this.signInCredential =
firebase.auth.PhoneAuthProvider.credential(verificationId, this.code);
alert("u"+JSON.stringify(this.signInCredential));
firebase.auth().signInWithCredential(this.signInCredential).then((info) =>
{
alert("check"+JSON.stringify(info));}, (error) => {
alert("err"+JSON.stringify(error));
})
}
i hope this will help you.
For your reference check this article
https://medium.com/@gbrigens/ionic-3-phone-authentication-with-firebase-dbed967e95ef
I am not able to jump to another screen using (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) { //alert("sms sent successfully"+ credential.verificationId); //this.verificationId = credential.verificationId; let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId}); modal.present(); }, error => { console.log("error: " + error); }); } because credential.verificationId value can't store in any variable
– suniel kalwani
Nov 19 '18 at 12:23
Are you getting any error while storing credential? and you are trying open a modal, is it opening?
– Ramesh Krishnan
Nov 19 '18 at 12:58
i am not getting any error but its showing undefined but when i alert( credential.verificationId) it showing a long string
– suniel kalwani
Nov 19 '18 at 13:09
@sunielkalwani you can store the credential in variables, i'm not understanding where you are getting undefined error?
– Ramesh Krishnan
Nov 19 '18 at 13:17
and instead of this.variable use let, var or constants to store credential, there is no restriction to store credential in a variable or any storage
– Ramesh Krishnan
Nov 19 '18 at 13:17
|
show 1 more comment
You should get the parameters from the nav params, directly it won't work.
try
constructor(public params: Navparams){
}
verify() {
let verificationId = params.get("verificationId");
this.signInCredential =
firebase.auth.PhoneAuthProvider.credential(verificationId, this.code);
alert("u"+JSON.stringify(this.signInCredential));
firebase.auth().signInWithCredential(this.signInCredential).then((info) =>
{
alert("check"+JSON.stringify(info));}, (error) => {
alert("err"+JSON.stringify(error));
})
}
i hope this will help you.
For your reference check this article
https://medium.com/@gbrigens/ionic-3-phone-authentication-with-firebase-dbed967e95ef
You should get the parameters from the nav params, directly it won't work.
try
constructor(public params: Navparams){
}
verify() {
let verificationId = params.get("verificationId");
this.signInCredential =
firebase.auth.PhoneAuthProvider.credential(verificationId, this.code);
alert("u"+JSON.stringify(this.signInCredential));
firebase.auth().signInWithCredential(this.signInCredential).then((info) =>
{
alert("check"+JSON.stringify(info));}, (error) => {
alert("err"+JSON.stringify(error));
})
}
i hope this will help you.
For your reference check this article
https://medium.com/@gbrigens/ionic-3-phone-authentication-with-firebase-dbed967e95ef
edited Nov 19 '18 at 13:37
answered Nov 19 '18 at 11:14
Ramesh KrishnanRamesh Krishnan
216
216
I am not able to jump to another screen using (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) { //alert("sms sent successfully"+ credential.verificationId); //this.verificationId = credential.verificationId; let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId}); modal.present(); }, error => { console.log("error: " + error); }); } because credential.verificationId value can't store in any variable
– suniel kalwani
Nov 19 '18 at 12:23
Are you getting any error while storing credential? and you are trying open a modal, is it opening?
– Ramesh Krishnan
Nov 19 '18 at 12:58
i am not getting any error but its showing undefined but when i alert( credential.verificationId) it showing a long string
– suniel kalwani
Nov 19 '18 at 13:09
@sunielkalwani you can store the credential in variables, i'm not understanding where you are getting undefined error?
– Ramesh Krishnan
Nov 19 '18 at 13:17
and instead of this.variable use let, var or constants to store credential, there is no restriction to store credential in a variable or any storage
– Ramesh Krishnan
Nov 19 '18 at 13:17
|
show 1 more comment
I am not able to jump to another screen using (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) { //alert("sms sent successfully"+ credential.verificationId); //this.verificationId = credential.verificationId; let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId}); modal.present(); }, error => { console.log("error: " + error); }); } because credential.verificationId value can't store in any variable
– suniel kalwani
Nov 19 '18 at 12:23
Are you getting any error while storing credential? and you are trying open a modal, is it opening?
– Ramesh Krishnan
Nov 19 '18 at 12:58
i am not getting any error but its showing undefined but when i alert( credential.verificationId) it showing a long string
– suniel kalwani
Nov 19 '18 at 13:09
@sunielkalwani you can store the credential in variables, i'm not understanding where you are getting undefined error?
– Ramesh Krishnan
Nov 19 '18 at 13:17
and instead of this.variable use let, var or constants to store credential, there is no restriction to store credential in a variable or any storage
– Ramesh Krishnan
Nov 19 '18 at 13:17
I am not able to jump to another screen using (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) { //alert("sms sent successfully"+ credential.verificationId); //this.verificationId = credential.verificationId; let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId}); modal.present(); }, error => { console.log("error: " + error); }); } because credential.verificationId value can't store in any variable
– suniel kalwani
Nov 19 '18 at 12:23
I am not able to jump to another screen using (<any>window).FirebasePlugin.verifyPhoneNumber('+91'+this.phone, 60, function (credential) { //alert("sms sent successfully"+ credential.verificationId); //this.verificationId = credential.verificationId; let modal = this.modalCtrl.create(verificationPage,{verificationId: credential.verificationId}); modal.present(); }, error => { console.log("error: " + error); }); } because credential.verificationId value can't store in any variable
– suniel kalwani
Nov 19 '18 at 12:23
Are you getting any error while storing credential? and you are trying open a modal, is it opening?
– Ramesh Krishnan
Nov 19 '18 at 12:58
Are you getting any error while storing credential? and you are trying open a modal, is it opening?
– Ramesh Krishnan
Nov 19 '18 at 12:58
i am not getting any error but its showing undefined but when i alert( credential.verificationId) it showing a long string
– suniel kalwani
Nov 19 '18 at 13:09
i am not getting any error but its showing undefined but when i alert( credential.verificationId) it showing a long string
– suniel kalwani
Nov 19 '18 at 13:09
@sunielkalwani you can store the credential in variables, i'm not understanding where you are getting undefined error?
– Ramesh Krishnan
Nov 19 '18 at 13:17
@sunielkalwani you can store the credential in variables, i'm not understanding where you are getting undefined error?
– Ramesh Krishnan
Nov 19 '18 at 13:17
and instead of this.variable use let, var or constants to store credential, there is no restriction to store credential in a variable or any storage
– Ramesh Krishnan
Nov 19 '18 at 13:17
and instead of this.variable use let, var or constants to store credential, there is no restriction to store credential in a variable or any storage
– Ramesh Krishnan
Nov 19 '18 at 13:17
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53319513%2fwindow-firebaseplugin-verifyphonenumber-function-response-unable-to-use-it%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown