You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to do chunk media upload for an Image. While my media/upload ( INIT) calls works fine, the next call for media/upload (APPEND) fails with authentication error: { errors: [ { code: 32, message: 'Could not authenticate you.' } ] }
I am using the same client object to make both the POST calls.
const appMediaConfig = {
subdomain: 'upload',
consumer_key: process.env.CONSUMER_KEY,
consumer_secret: process.env.CONSUMER_SECRET,
access_token_key: process.env.ACCESS_TOKEN,
access_token_secret: process.env.ACCESS_TOKEN_SECRET,
timeout_ms: 60 * 1000 // optional HTTP request timeout to apply to all requests.
};
Here's my code:
// THIS WORKSfunctioninitMediaUpload(){returnnewPromise(async(resolve,reject)=>{try{constresult=awaittwitterUpload.post("media/upload",{command: "INIT",media_type: "image/jpeg",total_bytes: WELCOME_IMAGE_SIZE,media_category: "dm_image"})resolve(result);}catch(error){// console.log("ERROR",error)reject(error);}})}// THIS FAILSfunctionappendMediaUpload(mediaid){returnnewPromise(async(resolve,reject)=>{try{constresult=awaittwitterUpload.post("media/upload",{command: "APPEND",media_id: mediaid,media: WELCOME_IMAGE,segment_index: 0})resolve(result);}catch(error){console.log("ERROR",error)reject(error);}})}
I am just calling the INIT function , save the media_id_string , then call the APPEND function with captured media_id_string.
I have been banging my head on this for quite some time now. Maybe i am missing something or is there a bug ?? Any help will be great ..
Thank you :)
The text was updated successfully, but these errors were encountered:
Hello,
I am trying to do chunk media upload for an Image. While my media/upload ( INIT) calls works fine, the next call for media/upload (APPEND) fails with authentication error:
{ errors: [ { code: 32, message: 'Could not authenticate you.' } ] }
I am using the same client object to make both the POST calls.
Here's my code:
I am just calling the INIT function , save the media_id_string , then call the APPEND function with captured media_id_string.
I have been banging my head on this for quite some time now. Maybe i am missing something or is there a bug ?? Any help will be great ..
Thank you :)
The text was updated successfully, but these errors were encountered: