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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:25:53+00:00 2026-06-06T13:25:53+00:00

I have a problem with setting the HTTPBody of a request correctly. I’m using

  • 0

I have a problem with setting the HTTPBody of a request correctly. I’m using Oauth to communicate with our API server, the only difference is, that I need to send the data through body, not the header (using OauthConsumer.framework – http://code.google.com/p/oauthconsumer/wiki/UsingOAuthConsumer).

This is my code:

NSString *oauthHeader = [NSString stringWithFormat:@"OAuth realm=\"%@\", oauth_consumer_key=\"%@\", %@oauth_signature_method=\"%@\", oauth_signature=\"%@\", oauth_timestamp=\"%@\", oauth_nonce=\"%@\", oauth_version=\"1.0\"%@",
                         [realm URLEncodedString],
                         [consumer.key URLEncodedString],
                         oauthToken,
                         [[signatureProvider name] URLEncodedString],
                         [signature URLEncodedString],
                         timestamp,
                         nonce,
                         extraParameters];

//[self setValue:oauthHeader forHTTPHeaderField:@"Authorization"];
NSLog(@"%@", oauthHeader);
[self setHTTPBody:[oauthHeader dataUsingEncoding:NSASCIIStringEncoding]];

This is the output of NSlog.

OAuth realm=””, oauth_consumer_key=”key”, oauth_signature_method=”HMAC-SHA1″, oauth_signature=”HT2UwJoW4dSNh1gXkAzQThLp0Sk%3D”, oauth_timestamp=”1340789377″, oauth_nonce=”3BDF0A1A-4FB0-40EF-95EA-5CB8B0FD07C1″, oauth_version=”1.0″

And this is what server reads, why the array is wrong? It’s not server side bug, our C# client does it without any problem.

array(1) {
  ["OAuth_realm"]=>
  string(215) """, oauth_consumer_key="key", oauth_signature_method="HMAC-SHA1", oauth_signature="HT2UwJoW4dSNh1gXkAzQThLp0Sk=", oauth_timestamp="1340789377", oauth_nonce="3BDF0A1A-4FB0-40EF-95EA-5CB8B0FD07C1", oauth_version="1.0""
}
  • 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-06T13:25:54+00:00Added an answer on June 6, 2026 at 1:25 pm

    The problem seems to be that you do not separate the different key-value-pairs from each other. This is simply done by concatenating them with “&” (without quotes). You set a comma between the key-value associations.
    In addition you don’t need to encapsulate the values within quotes unless you want these quotes to be a part of the value on receivers side.

    Your resulting data string should then look like this:

    NSString *oauthHeader = [NSString stringWithFormat:@"OAuth_realm=%@&oauth_consumer_key=%@&%@oauth_signature_method=%@&oauth_signature=%@&oauth_timestamp=%@&oauth_nonce=%@&oauth_version=1.0%@",
                         [realm URLEncodedString],
                         [consumer.key URLEncodedString],
                         oauthToken,
                         [[signatureProvider name] URLEncodedString],
                         [signature URLEncodedString],
                         timestamp,
                         nonce,
                         extraParameters];
    

    Keep in mind that your extraparameters need to be separated by “&” too.

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

Sidebar

Related Questions

i have problem to correctly bind data to WPF Chart. When i'm setting ItemsSource
I have a problem with setting up my Zend Framework application on live server.
I have problem setting the title view pager by using PagerTitleStrip. I added a
I'm using Mongoid for my app and I have a problem setting up correct
I have a problem setting null to a variant field using rtti. Suppose I
I have a problem setting value of an hidden input element. I've tried using
I have a problem setting up email notifications in SQL Server 2008. I am
Does SCP have a problem setting file permissions or have I misconfiguration my server?
I have problem with setting proper charset on my jsf pages. I use MySql
I have a problem with setting Browsing Path in Delphi 2009: When I install

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.