Browse files

Updated ASP.NET MVC3 quick starts to store less stuff in the session

  • Loading branch information...
1 parent ae7e186 commit 66d582093eb61158f945472181736f6cbef54c37 @bbaia bbaia committed Jan 25, 2012
View
5 ...es/Spring.OAuth1MvcQuickStart/Spring.OAuth1MvcQuickStart/Controllers/TwitterController.cs
@@ -42,7 +42,7 @@ public ActionResult Callback(string oauth_verifier)
AuthorizedRequestToken authorizedRequestToken = new AuthorizedRequestToken(requestToken, oauth_verifier);
OAuthToken token = twitterProvider.OAuthOperations.ExchangeForAccessTokenAsync(authorizedRequestToken, null).Result;
- Session["TwitterClient"] = twitterProvider.GetApi(token.Value, token.Secret);
+ Session["AccessToken"] = token;
return View();
}
@@ -57,7 +57,8 @@ public ActionResult UpdateStatus()
[HttpPost]
public ActionResult UpdateStatus(string status)
{
- ITwitter twitterClient = Session["TwitterClient"] as ITwitter;
+ OAuthToken token = Session["AccessToken"] as OAuthToken;
+ ITwitter twitterClient = twitterProvider.GetApi(token.Value, token.Secret);
twitterClient.UpdateStatusAsync(status).Wait();
View
5 ...s/Spring.OAuth2MvcQuickStart/Spring.OAuth2MvcQuickStart/Controllers/FacebookController.cs
@@ -43,7 +43,7 @@ public ActionResult Callback(string code)
AccessGrant accessGrant = facebookProvider.OAuthOperations.ExchangeForAccessAsync(
code, "http://localhost/Facebook/Callback", null).Result;
- Session["FacebookClient"] = facebookProvider.GetApi(accessGrant.AccessToken);
+ Session["AccessGrant"] = accessGrant;
return View();
}
@@ -58,7 +58,8 @@ public ActionResult UpdateStatus()
[HttpPost]
public ActionResult UpdateStatus(string status)
{
- IFacebook facebookClient = Session["FacebookClient"] as IFacebook;
+ AccessGrant accessGrant = Session["AccessGrant"] as AccessGrant;
+ IFacebook facebookClient = facebookProvider.GetApi(accessGrant.AccessToken);
facebookClient.UpdateStatusAsync(status).Wait();

0 comments on commit 66d5820

Please sign in to comment.