[Solved] Access user_location & relationships_status from facebook throws --> Uncaught (in promise): There was an error making the graph call


#1

Hello great folks!

I am trying to access FB user’s location and their relationship status. relationships_status is included in the below code. similarly I also tried to access the user locations but it throws back the error
Uncaught (in promise): There was an error making the graph call

this.facebook.getLoginStatus().then((fbstatus)=>
          { this.facebook.api('me?fields=id,name,email,first_name,last_name,picture.width(720).height(720).as(picture_large),birthday,gender,relationships_status',[]).then(profile => {
            this.userData={email:profile['email'], first_name:profile['first_name'], picture:profile['picture_large']['data']['url'],username:profile['name'],birthday:profile['birthday'],gender:profile['gender'],relationships_status:profile['relationships_status']}})
                              })

please let me know where I am going wrong? also I debug my app access token there I have permission for public_profile, email, user_friends only. Do I need to ask the location and relationship permissions as well? tried looking for it on google couldn’t find anything helpful.

Thanks in advance for your help!


#2

Anyways, figured it out the solution. You can mark this as resolved.
Basically you need to pass the fields during the login call ‘this.facebook.login()’ and by using facebook graph api explorer.