Dotnetopenauth Twitter The Remote Server Returned An Error 401 Unauthorized
Contents |
here for a quick overview of the the remote server returned an error 401 unauthorized twitter oauth site Help Center Detailed answers to any questions you remote server returned an error 401 unauthorized in c# might have Meta Discuss the workings and policies of this site About Us Learn
Remote Server Returned An Error 401 Unauthorized Iis 7
more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags
The Remote Server Returned An Error 401 Unauthorized Sharepoint Client Object Model
Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up DotNetOpenAuth Twitter Authenticaion Returning 401 Unauthorized up vote 5 down the remote server returned an error 401 unauthorized wcf vote favorite I'm starting to tear my hair out with Twitter and trying to signin a user!!! I have Facebook, Google, OpenId all working fine, just Twitter being a PAIN. I am constantly getting 401 Unauthorized when I try to run my code and for the life of me cannot figure out why. I have created a twitter client and and I'm using it with the InMemoryTokenManager from the DotNetOpenAuth sample solution. My Twitter client is here public class TwitterClient { private string UserName { get; set; } private static readonly ServiceProviderDescription ServiceDescription = new ServiceProviderDescription { RequestTokenEndpoint = new MessageReceivingEndpoint( "https://api.twitter.com/oauth/request_token", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest), UserAuthorizationEndpoint = new MessageReceivingEndpoint( "https://api.twitter.com/oauth/authorize", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest), AccessTokenEndpoint = new MessageReceivingEndpoint( "https://api.twitter.com/oauth/access_token", HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.AuthorizationHeaderRequest), TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() }, }; IConsumerTokenManager _tokenManager; public TwitterClient(IConsumerTokenManager tokenMana
unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The remote server
The Remote Server Returned An Error 401 Unauthorized Httpwebrequest
returned an error: (401) Unauthorized. Source Error: Line 273: finallyLine 274: {Line the remote server returned an error 401 unauthorized webrequest 275: webRequest.GetResponse().GetResponseStream().Close();Line 276: responseReader.Close();Line 277: responseReader = null; Source File: c:\Inetpub\wwwroot\Demo-OMP\App_Code\oAuthTwitter.cs Line: 275 kurrik 2011-10-10 20:30:55 UTC #2 Your request remote server returned an error 401 unauthorized iis7 is being rejected because there's an invalid or no authorization context. How are you passing authorization information? hiral1milestone 2012-04-24 10:13:36 UTC #3 same is happned with me. I make 150 request only http://stackoverflow.com/questions/15987734/dotnetopenauth-twitter-authenticaion-returning-401-unauthorized per hour. Is there solution for it? PitLord1108 2012-04-24 13:36:00 UTC #4 I got the same problem. my clinet used to work fine and it gets 401 Unauthorized now. it seems the oauth_token/Access token of my app is denied. If I try to open the authorize url, it returns "The request token for this page is invalid. It may have already been used, or expired https://twittercommunity.com/t/the-remote-server-returned-an-error-401-unauthorized/440 because it is too old. Please go back to the site or application that sent you here and try again; it was probably just a mistake. " I try some other app's authorize api url with oauth token. some of them is working fine and ask for authrize app. Anyone can help me? my app's authorize url:https://api.twitter.com/oauth/authorize?oauth_token=561901232-CBZywiSG2zVo7btPLVx9wzrRlgFxqsRkLguJAauP a working url from another app:https://api.twitter.com/oauth/authorize?oauth_token=O8dOyrJ3pF1AJfXD84kelhrI4oXunDJNmHORg0jEtg episod 2012-04-24 14:26:18 UTC #5 The first URL you show does not have a request token being sent to oauth/authorize -- that's an access token (you can tell because it has a user ID in the string). You must have some bug in your OAuth process right now that's re-using an existant access token on the authorize step when you should be using the request token you received from oauth/authorize tweetmysongcom 2012-05-11 14:32:43 UTC #6 I'm experiencing a similar issue. Everything was working just fine and now I am getting the following error. TwitterAPIException: Exception of type 'TwitterAPIException' was thrown. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() at TwitterVB2.TwitterOAuth.WebRequest(Method RequestMethod, String Url, String PostData) --- End of inner exception stack trace --- at Twit
Articles Technical Blogs Posting/Update Guidelines Article Help Forum Article Competition Submit an article or tip Post your Blog quick answersQ&A http://www.codeproject.com/Articles/247336/Twitter-OAuth-authentication-using-Net Ask a Question about this article Ask a Question View Unanswered Questions View All Questions... C# questions Linux questions ASP.NET questions SQL questions VB.NET questions discussionsforums All http://wenda.mojijs.com/Home/question/detail/id/14486585/p/1/index.html Message Boards... Application Lifecycle> Running a Business Sales / Marketing Collaboration / Beta Testing Work Issues Design and Architecture ASP.NET JavaScript C / C++ / MFC> remote server ATL / WTL / STL Managed C++/CLI C# Free Tools Objective-C and Swift Database Hardware & Devices> System Admin Hosting and Servers Java .NET Framework Android iOS Mobile SharePoint Silverlight / WPF Visual Basic Web Development Site Bugs / Suggestions Spam and Abuse Watch features Competitions News The Insider Newsletter The Daily Build remote server returned Newsletter Newsletter archive Surveys Product Showcase Research Library CodeProject Stuff communitylounge Who's Who Most Valuable Professionals The Lounge The Insider News The Weird & The Wonderful The Soapbox Press Releases Non-English Language > General Indian Topics General Chinese Topics help What is 'CodeProject'? General FAQ Ask a Question Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Articles » Platforms, Frameworks & Libraries » Social Network APIs » General ArticleBrowse CodeStatsRevisions (6)Alternatives Comments (85) Add your ownalternative version Tagged as C#.NETVS2010Visual-StudioDev Stats 169.2K views6.9K downloads52 bookmarked Posted 29 Aug 2011 Twitter OAuth authentication using .NET TheCodeKing, 26 Aug 2014 CPOL 4.78 (30 votes) 1 2 3 4 5 4.78/5 - 30 votes2 removedμ 4.68, σa 1.21 [?] Rate this: Please Sign up or sign in to vote. A example showing how to authenticate a Twitter application using oAuth and the application access token. Download source c
register my app with localhost so that I can test. Due to twitter not accepting this I changed the url to 127.0.0.1 I also tried adding the portnumber. I entered my secrets in the AuthConfig File. When I click on the twitter button I get the error The remote server returned an error: (401) Unauthorized. I then began to run my app on iis to fix a problem that my site couldn't login with my windows live account (that sorted that problem) but I still get this Unauthorized error. Someone please help. Thank you twitterasp.net-mvc-4dotnetopenauth edited Feb 3 at 19:29Jan 23 at 18:18David 1 I have nothing to do with this project, but it looks like a nice little alternative to DotNetOpenAuth (WorldDomination.Web.Authentication) –Chase Florell Jan 23 at 18:23 Also, for an answer to your question, we'll need to seez teh codez. –Chase Florell Jan 23 at 18:24 THere is'nt any code...well 2 lines in the auth config OAuthWebSecurity.RegisterTwitterClient –David Jan 29 at 16:40 2 Answers up vote3down voteaccepted+50 I had exactly the same problem and couldn't solve it with DotNetOpenAuth no matter what I tried. The authentication process for Twitter is far more difficult to get right than either Facebook or Google+ when using DotNetOpenAuth as it comes. After many frustrating hours, encrypting and encoding various parts of the data varying numbers of times and always getting the unhelpful 401 unauthorised, I added Tweetsharp into the mix and created my own IAuthenticationClient for Twitter authentication. It's fairly simple to perform the authentication with Tweetsharp. It becomes a relatively trivial matter of this: In your TwitterClient constructor: var twitterService = new TwitterService(consumerKey, consumerSecret); In your implementation of IAuthenticationClient: public void RequestAuthentication(HttpContextBase context, Uri returnUrl) { var requestToken =