I use Angular 2 Cordova Oauth plugin [] to implement FB login in my Cordova app.
Then I succeeded fetching user access token. Here is my code.
this.oauth.logInVia(this.facebookProvider).then(success => {
console.log("RESULT: " + JSON.stringify(success));
// HERE I WANT TO SEND REQUEST TO GET USER INFORMATION
}, error => {
console.log("ERROR: ", error);
});
But I don't know the way to retrieve user details after getting Facebook access token because I don't use Facebook SDK in this app. If anyone know a solution, please answer me it.
I use Angular 2 Cordova Oauth plugin [https://github./nraboy/ng2-cordova-oauth] to implement FB login in my Cordova app.
Then I succeeded fetching user access token. Here is my code.
this.oauth.logInVia(this.facebookProvider).then(success => {
console.log("RESULT: " + JSON.stringify(success));
// HERE I WANT TO SEND REQUEST TO GET USER INFORMATION
}, error => {
console.log("ERROR: ", error);
});
But I don't know the way to retrieve user details after getting Facebook access token because I don't use Facebook SDK in this app. If anyone know a solution, please answer me it.
Share Improve this question asked Jan 7, 2017 at 7:18 taku845taku845 1331 gold badge3 silver badges11 bronze badges1 Answer
Reset to default 8You need to make a GET request to Facebook Graph API with the access token received.
this.http.get(`https://graph.facebook./me?fields= "name,gender,location,picture/*any other fields*/&access_token=${access_token}`, new RequestOptions('Headers':new Headers({'Content-type:application/json'}))).then(result=>{});