public virtual TUserData GetCurrentUser <TUserData>() where TUserData : UserData { LoadTokenCookie(String.Empty); if (!IsCurrentUserAuthorized()) { return(null); } var accessToken = string.IsNullOrEmpty(AccessToken) ? "access_token=" + AuthToken : AccessToken + "=" + AuthToken; string responseText = (OAuthVersion == "1.0") ? ExecuteAuthorizedRequest(HttpMethod.GET, MeGraphEndpoint) : ExecuteWebRequest(HttpMethod.GET, GenerateRequestUri(MeGraphEndpoint.ToString(), accessToken), null, String.Empty); var user = Json.Deserialize <TUserData>(responseText); return(user); }
public TUserData GetCurrentUser <TUserData>() where TUserData : UserData { LoadTokenCookie(String.Empty); if (!IsCurrentUserAuthorized()) { return(null); } string responseText; if (OAuthVersion == "1.0") { responseText = ExecuteAuthorizedRequest(HttpMethod.GET, MeGraphEndpoint); } else { responseText = ExecuteWebRequest(HttpMethod.GET, new Uri(MeGraphEndpoint.ToString() + "?" + "access_token=" + AuthToken), null, String.Empty); } TUserData user = Json.Deserialize <TUserData>(responseText); return(user); }