Note that there are some explanatory texts on larger screens.

plurals
  1. POHelp with twitter echo & oauth in my rails app
    primarykey
    data
    text
    <p>My app requires from users to login with their twitter acount! I am using tardate oauth lib (from Paul Gallagher). That works fine. I wanna create an API for my website (actually the user authentication part). Twitter Basic Auth has been deprecated and now twitter uses twitter echo. If a user wants to upload a file via api in my app, he must include in his request the above header. So, my problem is: (i suppose that header hits twitter api directly and twitter returns in my url the response..is this right?)</p> <p>how my app can handle the twitter response? json that contains user's info (or a negative response 401), in order to continue the uploading or not. Something like the twitpic API does.(http://dev.twitpic.com/docs/2/upload/) or by similar services.</p> <pre><code>curl -v -H 'X-Auth-Service-Provider: https://api.twitter.com/1/account/verify_credentials.json' -H 'X-Verify-Credentials-Authorization: OAuth realm="http://api.twitter.com/", oauth_consumer_key="yTrEIQH6jhtmLUypg8T5", oauth_signature_method="HMAC-SHA1", oauth_token="514797-YuI8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWTyu",oauth_timestamp="1271323750", oauth_nonce="oYu6nMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7U9Y", oauth_version="1.0", oauth_signature="CV4bTfE7Rs9J1kafTGwufLJdspo%3D"' -F "file=@/path/to/file" http://localhost:3000/api/upload.xml </code></pre> <p>my def upload currently works for a simple upload via api. Without a user info. But in this way my app doesn't know the file owner!</p> <pre><code>def upload file = File.new file.file = params[:file] # ... extra code respond_to do |format| if file.save format.xml { render :xml =&gt; file, :status =&gt; :created, :location =&gt; file } else format.xml { render :xml =&gt; file.errors, :status =&gt; :unprocessable_entity } end end end </code></pre> <p>Do you have any idea how can be the coding logic? </p> <p>Any help will be highly appreciated :-)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload