Can we use localhost to tweet messages using oAuth authentication??

53 views
Skip to first unread message

Punit.khaire

unread,
Aug 7, 2010, 8:44:46 AM8/7/10
to Twitter Development Talk

Can we use localhost to tweet messages using oAuth authentication??


Tom

unread,
Aug 7, 2010, 7:43:33 PM8/7/10
to Twitter Development Talk
Yes, you can. Any application that can sign oAuth requests can send
tweets.

Tom

punit khaire

unread,
Aug 8, 2010, 1:30:39 AM8/8/10
to twitter-deve...@googlegroups.com
Thanks Tom,
 
I am using localhost to tweet messages but it is giving error message as Failed to authenticate with oauthe signature and token.Is this happening because I had given callback URL.I am generating proper signature and sending all parameters.
 
I am not getting where I am going wrong .
 
Punit.

Lumpizaver

unread,
Aug 9, 2010, 8:53:05 AM8/9/10
to Twitter Development Talk
I also have a problem with this.

I cannot use the twitter API login with OAuth when I am debugging on
localhost.
I tought that it is not possible to use Twitter authentication on
localhost because of the callback url.
So I tought that I have to upload my site somewhere before.

Sincerely, Jure

Taylor Singletary

unread,
Aug 9, 2010, 9:37:08 AM8/9/10
to twitter-deve...@googlegroups.com
For clarity:

There is nothing stopping you from using localhost as your oauth_callback during testing for OAuth 1.0a. While the form for your application on dev.twitter.com will not allow you to store a localhost domain as your pre-registered callback URL, our OAuth sub-system has no trouble using localhost for redirects when explicitly declared on the request token step. If you want to use localhost as your domain, just set the callback URL within your application record to something else.

As a reminder, it's proper OAuth to always send an oauth_callback on the request token step of OAuth negotiation -- even if you've preregistered a callback or are using the PIN code/out-of-band flow (in which case you would send oauth_callback=oob).

Taylor

Tom

unread,
Aug 9, 2010, 10:38:31 AM8/9/10
to Twitter Development Talk
If you are generating the right signature (which is quite a large
assumption) and sending the right parameters, then make sure you
aren't sending too much.

Signature + parameters are, as far as I know, the only things that can
cause a 401 error - assuming that the keys are right.

Just make sure to do proper URLencoding on the callback.

Tom

Andrew W. Donoho

unread,
Aug 9, 2010, 10:51:27 AM8/9/10
to twitter-deve...@googlegroups.com

On Aug 9, 2010, at 08:37 , Taylor Singletary wrote:

> As a reminder, it's proper OAuth to always send an oauth_callback on the request token step of OAuth negotiation -- even if you've preregistered a callback or are using the PIN code/out-of-band flow (in which case you would send oauth_callback=oob).

Taylor,

As a user of xauth, I do not currently send "oauth_callback=oob". I think this is because xauth does not participate in the negotiation for a temporary credential. (See: <http://tools.ietf.org/html/rfc5849> section 2.1.). Is this your understanding? Or do xauth users need to include this callback in our request for our permanent access token?


Anon,
Andrew
____________________________________
Andrew W. Donoho
Donoho Design Group, L.L.C.
a...@DDG.com, +1 (512) 750-7596

"We did not come to fear the future.
We came here to shape it."

-- President Barack Obama, Sept. 2009

Taylor Singletary

unread,
Aug 9, 2010, 10:53:52 AM8/9/10
to twitter-deve...@googlegroups.com
xAuth would not require this as no callback is utilized. In the case of actually executing API resource actions (like sending a tweet), your callback (and effectively OAuth itself) has nothing to do with the request -- it's only a means of identifying the two parties involved in the request ("the user" and "the application").

Lumpizaver

unread,
Aug 10, 2010, 4:13:35 AM8/10/10
to Twitter Development Talk
I am trying to create a simple "Log in with twitter application".
I am using this example: http://www.voiceoftech.com/swhitley/?p=681.
You can get all the code there.

But it throws out an error at this line

Response.Redirect(oAuth.AuthorizationLinkGet()); in oAuthTwitter
WebResponseGet.

Thanks for your help.

Sincerely, Jure


On 9 avg., 16:53, Taylor Singletary <taylorsinglet...@twitter.com>
wrote:
> xAuth would not require this as no callback is utilized. In the case of
> actually executing API resource actions (like sending a tweet), your
> callback (and effectively OAuth itself) has nothing to do with the request
> -- it's only a means of identifying the two parties involved in the request
> ("the user" and "the application").
>

Lumpizaver

unread,
Aug 10, 2010, 4:31:58 AM8/10/10
to Twitter Development Talk
I fixed that now, I just had to type "oob" as callback url. But now I
don't get redirected to the page I want to be. I just get a PIN
number, what should I do now?

Taylor Singletary

unread,
Aug 11, 2010, 12:55:30 PM8/11/10
to twitter-deve...@googlegroups.com
If your intent is to have Twitter redirect to a specific URL after the OAuth authetnication page is complete, you'll want to make sure that your application is marked as being a web-based application and you've provided a default callback URL (even though it doesn't have to correspond to your actual callback URL). Then, you manually declare the oauth_callback with your target callback URL instead of "oob"

Taylor
Reply all
Reply to author
Forward
0 new messages