public override OauthMemberData GetOauthMemberData(OauthRequest request) { var oauthmemberdata = GooglePlusApi.Get(request.AccessToken); if (string.IsNullOrEmpty(oauthmemberdata.OauthId)) { throw new Exception("Unable to get profile information from Google."); } // Store refresh token for long term access //oauthmemberdata.AccessToken = GooglePlusApi.GetRefreshToken(request.Code); return oauthmemberdata; }
override public OauthMemberData GetOauthMemberData(OauthRequest request) { var oauthmemberdata = GooglePlusApi.Get(request.AccessToken); if (string.IsNullOrEmpty(oauthmemberdata.OauthId)) { throw new Exception("Unable to get profile information from Google."); } // Store refresh token for long term access //oauthmemberdata.AccessToken = GooglePlusApi.GetRefreshToken(request.Code); return(oauthmemberdata); }
override public OauthMemberData GetOauthMemberData(OauthRequest request) { // Get Long Term Access Token string longtermaccesstoken = FacebookGraphApi.GetLongTermAccessToken(request.AccessToken, AppId, AppSecret); // Use Long Term Access Token to Get FBUser var oauthmemberdata = FacebookGraphApi.Get(longtermaccesstoken); if (string.IsNullOrEmpty(oauthmemberdata.OauthId) || string.IsNullOrEmpty(oauthmemberdata.Picture)) { throw new Exception("Unable to get profile information from Facebook."); } return(oauthmemberdata); }
public override OauthMemberData GetOauthMemberData(OauthRequest request) { // Get Long Term Access Token string longtermaccesstoken = FacebookGraphApi.GetLongTermAccessToken(request.AccessToken, AppId, AppSecret); // Use Long Term Access Token to Get FBUser var oauthmemberdata = FacebookGraphApi.Get(longtermaccesstoken); if (string.IsNullOrEmpty(oauthmemberdata.OauthId) || string.IsNullOrEmpty(oauthmemberdata.Picture)) { throw new Exception("Unable to get profile information from Facebook."); } return oauthmemberdata; }
public ActionResult Login(OauthRequest model, OauthProviderBase provider, string returnUrl) { try { var m = provider.Get(model); // Create/Update as needed OauthMemberRepository.Checkin(m); // Login System.Web.Security.FormsAuthentication.SetAuthCookie(m.Username, true); // Return return(Content(GetLocalUrl(returnUrl))); } catch (Exception ex) { return(Content("An error occurred. " + ex.Message + ex.StackTrace + ex.InnerException)); } }
public ActionResult GoogleLogin(OauthRequest model, string returnUrl) { return(Login(model, new GooglePlus.GooglePlusProvider(), returnUrl)); }
public ActionResult FacebookLogin(OauthRequest model, string returnUrl) { return(Login(model, new Facebook.FacebookProvider(), returnUrl)); }