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 1928936
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T07:05:10+00:00 2026-05-17T07:05:10+00:00

I will use xAuth to post data on my twitter account and I’m kind

  • 0

I will use xAuth to post data on my twitter account and I’m kind of stuck with the signature, header stuff.

I have the following code:

    // Build url
NSString *url = [NSString stringWithFormat:@"https://api.twitter.com/oauth/access_token?x_auth_username=%@&x_auth_password=%@&x_auth_mode=client_auth",
                 x_auth_username,
                 x_auth_password];

// Signature
NSString *oauth_nonce = @"";
NSString *oauth_signature_method = @"HMAC-SHA1";
NSString *oauth_timestamp = [NSString stringWithFormat:@"%0.0f", [[NSDate date] timeIntervalSince1970]];
NSString *oauth_version = @"1.0";
NSString *x_auth_mode = @"client_auth";

NSString *sig = [NSString stringWithFormat:@"https://api.twitter.com/oauth/access_token&oauth_consumer_key=%@&oauth_nonce=%@&oauth_signature_method=%@&oauth_timestamp=%@&oauth_version=%@&x_auth_mode=client_auth&x_auth_password=%@&x_auth_username=%@",
                 oauth_consumer_key,
                 oauth_nonce,
                 oauth_signature_method,
                 oauth_timestamp,
                 oauth_version,
                 x_auth_mode,
                 x_auth_password,
                 x_auth_username];

// Encode signature
NSString *encodedSig = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)sig,NULL,(CFStringRef)@"/:+,=&",kCFStringEncodingUTF8 );
NSLog(@"encoded signature:%@",encodedSig);

/*
    NSData *dSecret = [secret dataUsingEncoding:NSUTF8StringEncoding];
NSData *dBase = [base dataUsingEncoding:NSUTF8StringEncoding];
uint8_t result[CC_SHA1_DIGEST_LENGTH];
CCHmacContext hmacCtx;
memset(&hmacCtx, 0, sizeof(hmacCtx));
CCHmacInit(&hmacCtx, kCCHmacAlgSHA1, dSecret.bytes, dSecret.length);
CCHmacUpdate(&hmacCtx, dBase.bytes, dBase.length);
CCHmacFinal(&hmacCtx, result);
*/

// Headers
NSString *header = [NSString stringWithFormat:@"OAuth oauth_nonce=\"%@\", oauth_signature_method=\"%@\", oauth_timestamp=\"%@\", oauth_consumer_key=\"%@\", oauth_signature=\"%@\", oauth_version=\"%@\"",
                    oauth_nonce,
                    oauth_signature_method,
                    oauth_timestamp,
                    oauth_consumer_key,
                    oauth_signature,
                    oauth_version];

// Perform HTTP request
[Helpers httpPostWithString:encodedUrl];

I do not really see how to :
– encode the signature
– attach the signature and header to the request

Could you please help ?

Thanks a lot,

Luc

  • 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-05-17T07:05:13+00:00Added an answer on May 17, 2026 at 7:05 am

    Why reinvent the wheel? There are plenty of existing XAuth and OAuth libraries out there for you to use. link text

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I will use jQuery to perform the following: Upon click of elements with the
I will use (again) the following class hierarchy: Event and all the following classes
I will use the following javascript to display a Google Map Window in a
When Excel determines the axis values it will use to represent your data in
I will have a web-application which will use a few complex forms. One form
I have an image that I will use as the button. I need some
I have an client app which will use a connection string to get access
i will use RSpec with Factory girl in my Rails3 Project. I have installed
I have 4 days off and I will use this time to rewrite our
I have an application that will use a device in some cases (i.e. printer).

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.