Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

social_plus returning error 32

$
0
0

So I've been making use of social_plus to implement a twitter feed in my app. I can successfully call the built in sendTwitterImage function, as well as use the retweet and get user_timeline functions I wrote based off of sendTwitterImage's structure. However I'm trying to write a function to let me favorite tweets, but I keep getting error 32: "Could not authorize you" on that function call.

favorite : function(options) {
    this.authorize(function() {
        adapter.favorite({
            params : {
                id : options.id
            },
            title : "Twitter",
            onSuccess : options.success,
            onError : options.error
        }); 
    });
},
 
 
this.favorite = function(options) {
        Ti.API.info(options.params.id);
        var pUrl = "https://api.twitter.com/1.1/favorites/create.json";
        var pTitle = options.title;
        var pSuccessMessage = options.onSuccess, pErrorMessage = options.onError;
        if (accessToken == null || accessTokenSecret == null) {
            Ti.API.debug("The send status cannot be processed as the client doesn't have an access token. Authorize before trying to send.");
            return;
        }
        accessor.tokenSecret = accessTokenSecret;
        var message = createMessage(pUrl, "POST");
 
        message.parameters.push(["oauth_token", accessToken]);
        message.parameters.push(["oauth_timestamp", OAuth.timestamp()]);
        message.parameters.push(["oauth_nonce", OAuth.nonce(42)]);
        message.parameters.push(["oauth_version", "1.0"]);
 
        OAuth.SignatureMethod.sign(message, accessor);
        var parameterMap = OAuth.getParameterMap(message.parameters);
        client = Ti.Network.createHTTPClient({
            onload : function() {
                if (client.status == 200) {
                    pSuccessMessage && pSuccessMessage(this.responseText);
                } else {
                    pErrorMessage && pErrorMessage(this.responseText);
                }
            },
            onerror : function() {
                Ti.API.error("Social.js: FAILED to send a request!");
                Ti.API.error(this.responseText);
                pErrorMessage && pErrorMessage(this.responseText);
            }
        });
        client.open("POST", pUrl);
 
        header = OAuth.getAuthorizationHeader("", message.parameters);
        client.setRequestHeader("Authorization", header);
        if (!Ti.Android) {
            client.setRequestHeader("Content-Type", "multipart/form-data");
        }
        client.send(options.params);
I can confirm the id I'm passing in is correct as I can retweet the comment based on the same id. Does anyone know why I'm getting this error on only this function?

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>