not upload file on youtube using YouTube Data API v3 with different account javascript -


i developing chrome extension in want upload video on youtube. video uploading on youtube when using google account when sign in different google account video doesn't upload , generates error of unauthorized. in console generates following error

post https://www.googleapis.com/upload/youtube/v3/videos?part=snippet%2cstatus&uploadtype=resumable 401 ()

the code error generated

mediauploader.prototype.upload = function() { var self = this; var xhr = new xmlhttprequest();  xhr.open(this.httpmethod, this.url, true); xhr.setrequestheader('authorization', 'bearer ' + this.token); xhr.setrequestheader('content-type', 'application/json'); xhr.setrequestheader('x-upload-content-length', this.file.size); xhr.setrequestheader('x-upload-content-type', this.contenttype);  xhr.onload = function(e) {     if (e.target.status < 400) {         var location = e.target.getresponseheader('location');         this.url = location;         this.sendfile_();     } else {         this.onuploaderror_(e);     } }.bind(this); xhr.onerror = this.onuploaderror_.bind(this); xhr.send(json.stringify(this.metadata)); 

};

at xhr.send(json.stringify(this.metadata));


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -