Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7955781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:47:45+00:00 2026-06-04T03:47:45+00:00

I’m trying to make a simple Twitter App with Vala. I’m using the Vala

  • 0

I’m trying to make a simple Twitter App with Vala. I’m using the Vala Rest bindings (librest-dev v0.7). Everything works until I try to initialize an OAuthProxyCall, at which point I get this C error from the vala compiler:

someone@someone-UBook:~/workspace/vala/twitter$ valac --pkg rest-0.7 TwitterAuthTest.vala -o authtest
/home/someone/workspace/vala/twitter/TwitterAuthTest.vala.c: In function ‘twitter_auth_test_main’:
/home/someone/workspace/vala/twitter/TwitterAuthTest.vala.c:206:10: warning: assignment makes pointer from integer without a cast [enabled by default]
/tmp/ccEzeuFy.o: In function `twitter_auth_test_main':
TwitterAuthTest.vala.c:(.text+0x4a8): undefined reference to `oauth_proxy_call_new'
collect2: ld returned 1 exit status
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)

Here is my code as simply as I could make it:

using Rest;

public class TwitterAuthTest {
    private static const string CONSUMER_KEY = "XXXXXXXXXXXXXXXXXXXXXX";
    private static const string CONSUMER_SECRET = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    private static const string URL_FORMAT = "https://api.twitter.com";
    private static const string REQUEST_TOKEN_URL = "https://api.twitter.com/oauth/request_token";

    private static const string FUNCTION_ACCESS_TOKEN = "oauth/access_token";
    private static const string FUNCTION_STATUSES_UPDATE = "statuses/update.xml";

    private static const string PARAM_STATUS = "status";

    public static int main(string[] args) {
        // initialize proxy
        var proxy = new OAuthProxy(CONSUMER_KEY, CONSUMER_SECRET, URL_FORMAT, false); // false = url doesn't require expansion

        // request token
        try {
            proxy.request_token("oauth/request_token", "oob");
        } catch (Error e) {
            stderr.printf("Couldn't get request token: %s\n", e.message);
        }

        // prompt user for pin
        stdout.printf("Go to http://twitter.com/oauth/authorize?oauth_token=%s then enter the PIN\n", proxy.get_token());
        string pin = stdin.read_line(); //3001930

        // access token
        try { proxy.access_token(FUNCTION_ACCESS_TOKEN, pin); }
        catch (Error e) {
            stderr.printf("Couldn't get access token: %s\n", e.message);
        }

        // setup call
        OAuthProxyCall call = new OAuthProxyCall();
        call.set_function(FUNCTION_STATUSES_UPDATE);
        call.add_param(PARAM_STATUS, "Hello from librest!");
        try { call.sync(); } catch (Error e) {
            stderr.printf("Cannot make call: %s\n", e.message);
        }

        return 0;
    }
}

I’m completely unfamiliar with REST/OAUTH–how do I need to setup my OAuthProxyCall in order to make this compile correctly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:47:46+00:00Added an answer on June 4, 2026 at 3:47 am

    Evidently there is no constructor for a ProxyCall. I changed the first line of the //setup call section to ProxyCall call = proxy.new_call(); instead of OAuthProxyCall call = new OAuthProxyCall(); and that seems to have gotten rid of the error. It now compiles although Twitter is still yelling at me.

    Update: Here is the correct code (version with syntax highlighting):

    using Rest;
    
    public class SimpleTweet {
        private static const string CONSUMER_KEY = "#######################"; // this comes from your app's twitter account page
        private static const string CONSUMER_SECRET = "########################################"; // this comes from your app's twitter account page
        private static const string URL_FORMAT = "https://api.twitter.com";
        private static const string REQUEST_TOKEN_URL = "https://api.twitter.com/oauth/request_token";
    
        private static const string FUNCTION_ACCESS_TOKEN = "oauth/access_token";
        private static const string FUNCTION_STATUSES_UPDATE = "1/statuses/update.xml";
    
        private static const string PARAM_STATUS = "status";
    
        public static int main(string[] args) {
            // make sure there is a message to tweet
            if(args[1] == null || args[1] == "") {
                stdout.printf("No tweet message specified.\n");
                return 0;
            }
    
            /** Authenticating with Twitter */
            // initialize proxy
            var proxy = new OAuthProxy(CONSUMER_KEY, CONSUMER_SECRET, URL_FORMAT, false);
    
            // request token
            try {
                proxy.request_token("oauth/request_token", "oob");
            } catch (Error e) {
                stderr.printf("Couldn't get request token: %s\n", e.message);
                return 1;
            }
    
            // prompt user for pin
            stdout.printf("Go to http://twitter.com/oauth/authorize?oauth_token=%s then enter the PIN\n", proxy.get_token());
            string pin = stdin.read_line();
    
            // access token
            try { proxy.access_token(FUNCTION_ACCESS_TOKEN, pin); }
            catch (Error e) {
                stderr.printf("Couldn't get access token: %s\n", e.message);
                return 1;
            }
    
            /** sending the tweet */
            // setup call
            ProxyCall call = proxy.new_call();
            call.set_function(FUNCTION_STATUSES_UPDATE);
            call.set_method("POST");
            call.add_param(PARAM_STATUS, args[1]);
            try { call.sync(); } catch (Error e) {
                stderr.printf("Cannot make call: %s\n", e.message);
                return 1;
            }
    
            // print success
            stdout.printf("Tweet succeeded!\n");
    
            return 0;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.