Firebase and Facebook API Calls -
i in need of help. building application , have run bump. i'm trying make api calls graph api facebook not under new account. using linkwithredirect link facebook account email , password account on firebase. after complete everytime try , make call graph api says account linked. `
facebook.addeventlistener('click', e => { // first, perform signinwithredirect. // creates provider object. var provider = new firebase.auth.facebookauthprovider(); provider.addscope('public_profile'); provider.addscope('email'); provider.addscope('user_photos'); provider.addscope('manage_pages'); provider.addscope('publish_pages'); provider.addscope('business_management'); provider.addscope('read_insights'); // provider.addscope('public_actions'); // can add additional scopes provider:x auth.currentuser.linkwithredirect(provider).then(function(){ firebase.auth().getredirectresult().then(function(result) { if (result.credential) { // gives google access token. // can use access google api. facebooktoken = result.credential.accesstoken; // signed-in user info. var user = result.user; } }).catch(function(error) { // handle errors here. var errorcode = error.code; var errormessage = error.message; console.log(errormessage + " code:" + errorcode); }); }); if(user){ fb.api('/me', {fields: 'last_name'}, function(response) { document.getelementbyid('status').innerhtml= response.last_name; console.log(response); }); document.getelementbyid('facebook').style.visibility = 'hidden'; document.getelementbyid('fbunlink').style.visibility = 'visible'; } else { document.getelementbyid('status').innerhtml= 'you not logged in.'; document.getelementbyid('facebook').style.visibility = 'visible'; document.getelementbyid('fbunlink').style.visibility = 'hidden'; } });
Comments
Post a Comment