Retrieve Facebook profile from Xamarin client -
i basic user information facebook after user has logged in.
i've looked @ documentation in how to: work authentication , under "how to: retrieve authenticated user information" section, shows how .net backend code using httpclient
make call accesstoken:
var fbrequesturl = "https://graph.facebook.com/me/feed?access_token=" + credentials.accesstoken;
since mobile client has accesstoken mobileservices, can client make call directly facebook endpoint, or client sdk provide built-in functionality?
i've been following xamarin.forms sport project , way user information google hard-coding google endpoint , making call user info.
note: xamarin.forms sport uses mobile services, not mobile app, not sure if makes difference.
it sounds you're doing server-directed login: making call backend login dance facebook. in this, client application making call .auth/login/facebook, opens browser or web authentication broker enter credentials. end result receive zumo access token (different facebook access token).
you cannot use zumo access token access facebook apis itself. in "how to:" linked, show how use getappserviceidentityasync backend facebook access token. possible because have stored facebook client id via portal, available backend.
the advantage of doing auth don't have deploy facebook client id mobile apps. if wanted access facebook apis client, though, you'll need facebook token client.
few ways can suggest:
call .auth/me client. response give json object can parse should include fb token associated zumo token.
write custom api [authorize] attribute set perform getappserviceidentityasync , respond value of facebook access token. can parse response client. .auth/me does, can write give fb access token.
use facebook .net sdk http://facebooksdk.net/ client-directed login. facebook token on client, , can use our loginasync(facebook, access_token) method zumo token client can access both facebook , mobile app backend. disadvantage, mentioned before, you'll have deploy fb client id app.
Comments
Post a Comment