Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not authenticate you. #154

Open
tss123456 opened this issue Apr 18, 2018 · 0 comments
Open

Could not authenticate you. #154

tss123456 opened this issue Apr 18, 2018 · 0 comments

Comments

@tss123456
Copy link

i am getting following error

code:32
message:"Could not authenticate you."

when i write code for append details for upload video on twitter using codebird-js

following code are we use for upload video

function TwitterPosting(message, image, Credential, priority, priorityDate, OnSuccess, onError) {
var convertFunction = convertFileToDataURLviaFileReader(image, function (base64) {
var blob = dataURItoBlob(base64);
var cb = new Codebird;
cb.setConsumerKey(Credential[0].Key, Credential[0].Secret);
cb.setToken(Credential[0].Access_x0020_Token, Credential[0].Access_x0020_Token_x0020_Secret);
try {

        //upload media
        base64 = base64.split(",")[1];
        var params1 = {
            //"media_data": base64,
            "media_type": "video/mp4",
            "media_category": "amplify_video",
            "command": "INIT",
            "total_bytes": "456174",
            "Name": "Default"
        };
        cb.__call(
            "media_upload",
            params1,
            function (reply, rate, err) {

                var params2 = {
                    //"media_ids": reply.media_id_string,
                    //"status": message,
                    "Name": "Default",
                    "command": "APPEND",
                    "media_id": reply.media_id,
                    "media": blob,
                    "media_data": base64,
                    "segment_index": 0,

                };
                cb.__call(
                    "media_upload",
                    params2,
                    function (reply, rate, err) {

                        var params3 = {

                            "Name": "Default",
                            "command": "FINALIZE",
                            "media_id": reply.media_id,

                        };
                        cb.__call(
                            "media_upload",
                            params3,

                        function (reply, rate, err) {

                            var params4 = {
                                "Name": "Default",
                                "command": "STATUS",
                                "media_id": reply.media_id,
                            };

                            cb.__call(
                               "media_upload",
                                params4,
                            function (reply, rate, err) {
                                if (reply.id) {
                                    OnSuccess();
                                } else {
                                    onError(reply);
                                }
                            }
                          );
                        }

                       );
                    }
                  );
            }
        );
    } catch (e) {
        console.log(e);
    }
});

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants