windows phone 8 - How to get user email, public_profile from facebook access_token -
i'm building windows phone 8.1 app allow user login facebook account.
there code:
string productid = "myproductid"; string facebookappid = "myfacebookappid"; string redirecturi = "msft-"+productid+"://authorize"; string scope = "public_profile,email"; // want fetch facebook user string responsetype = "token"; // other response types possible uribuilder authuri = new uribuilder("https://www.facebook.com/dialog/oauth"); authuri.query = "client_id=" + facebookappid + "&redirect_uri=" + redirecturi + "&scope=" + scope + "&response_type=" + responsetype; var success = await windows.system.launcher.launchuriasync(uritolaunch);
and code in app.xaml.cs:
protected override void onactivated(iactivatedeventargs args) { base.onactivated(args); if (args.kind == activationkind.webauthenticationbrokercontinuation) { app.mobileservice.logincomplete(args webauthenticationbrokercontinuationeventargs); } if (args.kind == activationkind.protocol) { protocolactivatedeventargs eventargs = args protocolactivatedeventargs; wwwformurldecoder decoder = new wwwformurldecoder(eventargs.uri.fragment); string fbaccesstoken = decoder.getfirstvaluebyname("#access_token"); /* can use access token interact facebook api */ } }
but how user's email , profile "fbaccesstoken"?
thanks.
you can use graph apis of facebook
graph.facebook.com/me?access_token={0}
please refer link - https://developers.facebook.com/docs/graph-api/using-graph-api/v2.3
Comments
Post a Comment