Problem uploading videos - Bad Authentication data


#1

I am trying to upload video to twitter at /1.1/media/upload.json endpoint. I am receiving Bad Authentication data error. I want to know what Authntication parameters I have to use for all INIT, APPEND and FINISH phases…
I am collecting oauth_token from call back url manually…do I need to use that token and Authorization header as part of the request…Please confirm…Thanks


Chunked Upload not working
#2

Yes, you certainly need to authorize your request with a valid user token.

We have a sample in Python that demonstrates the upload flow, as well as some examples using twurl. If you’re not using an API client library that handles the authentication for you in the language of your choice, I’d recommend running through the twurl steps using the -t flag to trace out the HTTP calls.


#3

Thank you @andypiper for your response.

I want to make myself clear on few things…

I am using java to achieve the above behaviour.
First, i am calling oauth/request_token end point an able to get oauth_token.
Then, i am calling oauth/authorize end point where my user will authorize my app and I am getting oauth_token an oauth_verifier to my call back url…
Then, I am calling oauth/access_token end point an passing oauth_verifier and valid Authorization header to this end point and in response, I am getting oauth_token, oauth_token_secret, user_id,screen_name and x_auth_epires as response…
Here, oauth_token and oauth_token_secret are same as access_token and access_token_secret in my app…
Our website will have a twitter logo which will enable the user to post a video to twitter.
Could you please confirm, if the above flow is correct and which token I have to use when I am trying to post a video to /1.1/media/upload.json endpoint. Do I also need to pass authorization header…?

Sorry for the long question and thank you for your patience towards this…


#4

Hello Andy, @andypiper

Can you please confirm on my above concern…I am unable to make a succesfull INIT call to media/upload.json end point. Please let me know the exact authorization headers required to make a successfull call to the above…Thank you…


#5

Hello @andypiper,

You got anytime to look at this thread…I am sending authorisation header also for INIT request and it is saying “cannot authenticate you”, error code : 32
Please help me what I am missing and let me know the exact headers for authorisation that needs to be passed to media/upload.json endpoint…

Thanks in advance…


#6

As I mentioned, probably the best thing to do here would be to trace out the way in which a tool like twurl posts the auth headers. An alternative would be to use an established library like Twitter4J instead of rolling your own OAuth flow. I don’t know if Twitter4J has a chunked video upload example, though.