Im converting to MVC from webforms. My app uses oAuth (DevDefinedOauth).
Here is some code used in the webforms application AND the MVC app (I have commented the webforms response.redirect). This code runs in a protected void method within the controller (MVC) or within the .CS file (webforms)
var session = new OAuthSession(consumerContext, requestUrl, userAuthorizeUrl, accessUrl, callBackUrl);
// get a request token from the provider
IToken requestToken = session.GetRequestToken();
// generate a user authorize url for this token (which you can use in a redirect from the current site)
string authorizationLink = session.GetUserAuthorizationUrlForToken(requestToken, callBackUrl);
Session["oAuthSession"] = session;
Session["oAuthToken"] = requestToken;
//Old Response Redirect from Webforms
//Response.Redirect(authorizationLink);
Redirect(authorizationLink);
In MVC, using the regular webforms response.redirect (commented), it seems to work, it takes me to the expcted Authorization page (yahoo) however it is not quite right because once i accept the oauth, the page crashes when it returns to my own page.
NOTE - If i FIRST use my old aspx page to authenticate, then go over to my controller/action that is using oauth, everything works properly. (Probably because the session is storing/working p0roperly?)
I'm new to oauth. I am just happy it is working, even if i have to use the aspx site first. Is there a proper way to do this using MVC though?