Skip to content

ziyasal-archive/TwitterOAuth

Repository files navigation

TwitterOAuth

Twitter OAuth library for .net apps,

Nuget Package

To Install:

Install-Package TwitterOAuth

Documentation

Add following configuration to appSettings below web.config file

<add key="Tw-ApiKey" value="your consumer key here"/>
<add key="Tw-AppSecret" value="your consumer secret here"/>
<add key="Tw-RedirectUri" value="your redirected uri here"/>
  1. Setup Authentication Link (Button)

Markup

 <a href='http://twitter.com/oauth/authorize?<%=GetUrlParamters()%>'>Login with Twitter</a>

Code Behind

protected string GetUrlParamters()
{
    ITwitterOAuthManager oAuthManager = new TwitterOAuthManager();
    return oAuthManager.GetUrlParameters();
 }
  1. After Twitter redirected to referrer url, Redirected page code behind
protected void Page_Load(object sender, EventArgs e)
{
     ITwitterOAuthManager oAuthManager = new TwitterOAuthManager();

     if (oAuthManager.CheckTwitterOAuthRequest(Request.QueryString))
     {
          TwitterBasicProfile result = oAuthManager.Authenticate(Request.QueryString);
          txtHtmlArea.InnerHtml = Server.HtmlEncode(result.ScreenName);
     }
}

Redirected page markup

<div id="txtHtmlArea" runat="server"></div>

About

Twitter OAuth library for .Net apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published