/// <summary> /// Prepares a redirect that will send the user to Twitter to sign in. /// </summary> /// <param name="forceNewLogin">if set to <c>true</c> the user will be required to re-enter their Twitter credentials even if already logged in to Twitter.</param> /// <returns>The redirect message.</returns> /// <remarks> /// Call <see cref="OutgoingWebResponse.Send"/> or /// <c>return StartSignInWithTwitter().<see cref="MessagingUtilities.AsActionResult">AsActionResult()</see></c> /// to actually perform the redirect. /// </remarks> public static OutgoingWebResponse StartSignInWithTwitter(bool forceNewLogin) { var redirectParameters = new Dictionary <string, string>(); if (forceNewLogin) { redirectParameters["force_login"] = "******"; } Uri callback = MessagingUtilities.GetRequestUrlFromContext().StripQueryArgumentsWithPrefix("oauth_"); var request = TwitterSignIn.PrepareRequestUserAuthorization(callback, null, redirectParameters); return(TwitterSignIn.Channel.PrepareResponse(request)); }
/// <summary> /// Prepares a redirect that will send the user to Twitter to sign in. /// </summary> /// <param name="forceNewLogin">if set to <c>true</c> the user will be required to re-enter their Twitter credentials even if already logged in to Twitter.</param> /// <returns>The redirect message.</returns> /// <remarks> /// Call <see cref="OutgoingWebResponse.Send"/> or /// <c>return StartSignInWithTwitter().<see cref="MessagingUtilities.AsActionResult">AsActionResult()</see></c> /// to actually perform the redirect. /// </remarks> public static OutgoingWebResponse StartSignInWithTwitter(bool forceNewLogin, Uri callback) { Contract.Requires(callback != null); var redirectParameters = new Dictionary <string, string>(); if (forceNewLogin) { redirectParameters["force_login"] = "******"; } var request = TwitterSignIn.PrepareRequestUserAuthorization(callback, null, redirectParameters); return(TwitterSignIn.Channel.PrepareResponse(request)); }
public OutgoingWebResponse StartSignInWithTwitter(Uri callback = null) { if (callback == null) { callback = MessagingUtilities .GetRequestUrlFromContext() .StripQueryArgumentsWithPrefix("oauth_"); } var request = TwitterSignIn .PrepareRequestUserAuthorization(callback, null, null); return (TwitterSignIn .Channel .PrepareResponse(request)); }