public MeInfo UserInfoSafe(IFacebookAccess fbAccess) { MeInfo result = null; try { result = this.UserInfo(fbAccess); } catch (FacebookOAuthException) { //Logging Needed } catch { //Logging Needed } return(result); }
public MeInfo UserInfo(IFacebookAccess fbAccess) { if (null == fbAccess) { throw new ArgumentNullException("facebook access"); } if (string.IsNullOrWhiteSpace(fbAccess.FacebookAccessToken)) { throw new ArgumentException("access token"); } var client = this.Client(fbAccess.FacebookAccessToken); dynamic result = client.Get("me?fields=name,id,email"); return(new MeInfo() { FacebookId = long.Parse(result.id), Name = result.name, Email = result.email, FacebookAccessToken = fbAccess.FacebookAccessToken, FacebookTokenExpiration = fbAccess.FacebookTokenExpiration, }); }