Missing required oauth parameter:

597 views
Skip to first unread message

ham

unread,
Mar 13, 2011, 11:03:52 PM3/13/11
to FatSecret Platform API
This is the header i am sending to FatSecret

oauth_consumer_key=my_consumer_public_key, oauth_nonce=1300071440524,
oauth_signature=signature_generated oauth_signature_method=HMAC-SHA1,
oauth_timestamp=1300071440, oauth_version=1.0

And this is the response i am getting.

<?xml version="1.0" encoding="utf-8" ?><error xmlns="http://
platform.fatsecret.com/api/1.0/" xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance" xsi:schemaLocation="http://platform.fatsecret.com/
api/1.0/ http://platform.fatsecret.com/api/1.0/fatsecret.xsd">
<code>2</code> <message>Missing required oauth parameter:
oauth_signature_method</message></error>


Can anyone please help me narrow down the problem.
SInce in the header i am sending oauth_signature_method=HMAC-SHA.


ham

unread,
Mar 14, 2011, 12:15:21 AM3/14/11
to FatSecret Platform API
hi,
i figured that one out since there was a missing method .
now my new header is

food_id=4384&method=food.get&oauth_consumer_key=MY_API_KEY&oauth_nonce=1300075545711&oauth_signature=prg
%2F7fJgAFtkqTmNSWgP6VaRvrE%3D&oauth_signature_method=HMAC-
SHA1&oauth_timestamp=1300075545&oauth_version=1.

i get signature is invalid....

Can some one give me hints to what can be wrong.?
I am using java Api to generate signature
//calculate signature value
Mac m = Mac.getInstance("HmacSHA1");
m.init(new SecretKeySpec(CONSUMER_SECRET.getBytes(),
"HmacSHA1"));
m.update(signature_base_string.getBytes());
byte[] res = m.doFinal();
String sig = Base64.encodeBytes(res);
sig = URLEncoder.encode(sig,"UTF-8");

The signature i get is rg%2F7fJgAFtkqTmNSWgP6VaRvrE%3D

Do i need to URLEncode the base64encoded string as well?
Well without that also i get same error.
Invalid signature: oauth_signature






On Mar 13, 11:03 pm, ham <hamish.tus...@gmail.com> wrote:
> This is the header i am sending to FatSecret
>
> oauth_consumer_key=my_consumer_public_key, oauth_nonce=1300071440524,
> oauth_signature=signature_generated oauth_signature_method=HMAC-SHA1,
> oauth_timestamp=1300071440, oauth_version=1.0
>
> And this is the response i am getting.
>
> <?xml version="1.0" encoding="utf-8" ?><error xmlns="http://
> platform.fatsecret.com/api/1.0/" xmlns:xsi="http://www.w3.org/2001/
> XMLSchema-instance" xsi:schemaLocation="http://platform.fatsecret.com/
> api/1.0/http://platform.fatsecret.com/api/1.0/fatsecret.xsd">

David

unread,
Mar 17, 2011, 8:31:05 AM3/17/11
to fatsecret-p...@googlegroups.com
Hi Ham,
Sorry it took so long - are you getting fat secret data yet ?

David C. Simmons
Information Quality Works
424 558-6406
"Courage does not always roar. Sometimes, it is the quiet voice at the end
of the day saying "I will try again tomorrow."
 

food_id=4384&method=food.get&oauth_consumer_key=MY_API_KEY&oauth_nonce=13000
75545711&oauth_signature=prg
%2F7fJgAFtkqTmNSWgP6VaRvrE%3D&oauth_signature_method=HMAC-
SHA1&oauth_timestamp=1300075545&oauth_version=1.

--
You received this message because you are subscribed to the Google Groups
"FatSecret Platform API" group.
To post to this group, send email to
fatsecret-p...@googlegroups.com.
To unsubscribe from this group, send email to
fatsecret-platfor...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/fatsecret-platform-api?hl=en.


No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.449 / Virus Database: 271.1.1/3502 - Release Date: 03/13/11
07:34:00

hamish tushar chandola

unread,
Mar 17, 2011, 9:13:11 AM3/17/11
to fatsecret-p...@googlegroups.com
Hi David,
Yes i got it to work finally.

Thanks
Hamish
--
~Hamish
~~~~~Hope is a good thing, maybe the best of things, and no good thing ever dies.

David

unread,
Mar 17, 2011, 9:33:15 AM3/17/11
to fatsecret-p...@googlegroups.com

Good. 

Version: 8.5.449 / Virus Database: 271.1.1/3510 - Release Date: 03/16/11 07:34:00

Andong

unread,
Mar 31, 2011, 1:05:23 PM3/31/11
to FatSecret Platform API
Hi Ham,

I have the similar problem. Could you tell me how to solve this
invalid signature problem?

Thank you very much!
Andong

On Mar 17, 9:13 am, hamish tushar chandola <hamish.tus...@gmail.com>
wrote:

Кошкаров Владимир

unread,
Oct 10, 2023, 11:43:40 PM10/10/23
to FatSecret Platform API
Hello everyone!
I'm trying to send my first autorization request and to face a problem
Can anybody suggest me, where am I fault, pls?

on my request I have that response:
'Missing required parameter: oauth_consumer_key'

My code:
----------------------
url_api = 'https://www.fatsecret.com/oauth/request_token'
http_method = 'GET'

Consumer_Key = '***'
Consumer_Secret = '***'

Access_Secret = ''

grant_type = 'client_credentials'

params = {'oauth_consumer_key':Consumer_Key,
          'oauth_signature_method':'HMAC-SHA1',
          'oauth_timestamp':str(int(time.time())),
          'oauth_nonce':'1234',
          'oauth_version':'1.0',
          'oauth_callback':'oob'
         }

def create_signature(secret_key, signature_base_string):
    encoded_string = signature_base_string.encode()
    encoded_key = secret_key.encode()
    temp = hmac.new(encoded_key, encoded_string, hashlib.sha1).hexdigest()
    byte_array = b64encode(binascii.unhexlify(temp))
    return byte_array.decode()

params_normalized = urllib.parse.urlencode(sorted(params.items()))
params_encoded = urllib.parse.quote(params_normalized, safe='')

url_api_encoded = urllib.parse.quote(url_api, safe='')

Signature_Base_String = '&'.join([http_method, url_api_encoded, params_encoded])

signing_key = Consumer_Secret + '&' + Access_Secret

oauth_signature = create_signature(signing_key, Signature_Base_String)
oauth_signature_encoded = urllib.parse.quote(oauth_signature, safe='')

body = {'grant_type' : grant_type}

autorization = ','.join([f'OAuth oauth_consumer_key="{params["oauth_consumer_key"]}"',
                         f'oauth_nonce="{params["oauth_nonce"]}"',
                         f'oauth_signature="{oauth_signature_encoded}"',
                         f'oauth_signature_method="{params["oauth_signature_method"]}"',
                         f'oauth_timestamp="{params["oauth_timestamp"]}"',
                         f'oauth_version="{params["oauth_version"]}"',
                         f'oauth_callback="{params["oauth_callback"]}"'])

headers = {
            'Content-Type' : 'application/x-www-form-urlencoded',
            'Authorization' : autorization
          }

response = requests.post(url_api, data=body, headers=headers)
----------------------

I will be grateful for your any advice

пятница, 1 апреля 2011 г. в 00:05:23 UTC+7, Andong:

seba...@fatsecret.com

unread,
Oct 11, 2023, 7:21:18 AM10/11/23
to FatSecret Platform API
Hi there,
Thanks for reaching out. We recommend using Postman first to test the API and to also validate your authentication.
Then you can use these for your own app/backend.
Kind regards,
The FatSecret Platform API Team

Reply all
Reply to author
Forward
0 new messages