Closed dellock6 closed 7 years ago
Hi Luca,
It seems that your timestamp is not in the correct format. The error is printed in the following format:
oauth timestamp invalid: ' . $timestamp . (' . $now . ')
which means from your error code that a null timestamp is being submitted because the value in the parenthesis was the current timestamp.
If you have any questions, just email me back.
Thanks,
Vicki
On Thu, Apr 14, 2016 at 8:20 AM, dellock6 notifications@github.com wrote:
Hi, I'm working on a simple bash script (on mac os x) to grab different informations from tripit API, but I canàt get past the request token, as I constantly receive this error:
401105.100000oauth timestamp invalid: (1460646461)
Timestamp is created using:
timestamp=$(date +%s)
and the complete string is this:
curl -X POST -d "oauth_consumer_key=${key}&secret=${secret}&oauth_timestamp=${timestamp}&oauth_nonce=${OAuth_nonce}" https://api.tripit.com/oauth/request_token
key and secret are passed correctly as I've tried to remove them and API returns the error about those missing. But I can't get pass the timestamp.
Thanks, Luca
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/tripit/api/issues/158
Thanks Vicki, as I wrote the timestamp is created using the string: timestamp=$(date +%s) and if I echo it in the middle of the script, it's correctly returned,and the time in the error is usually 1-2 seconds after my echo, and seems correct as it's the time it takes from the echo to the one-liner.
But if I try to pass the variable as I wrote in the one-liner, it errors out. Really no idea what's wrong in the string... I'm maybe missing out something obvious (and stupid once I figure it out) but right now I'm not seeing it.
Timestamp for oauth should be the seconds since epoch, correct? And this in linux is created using date +%s as in the script.
Thanks for the help. Luca
Yes the timestamp is seconds since epoch. Can you send me the curl request you are making?
Thanks,
Vicki
On Mon, Apr 18, 2016 at 12:32 PM, dellock6 notifications@github.com wrote:
Thanks Vicki, as I wrote the timestamp is created using the string: timestamp=$(date +%s) and if I echo it in the middle of the script, it's correctly returned,and the time in the error is usually 1-2 seconds after my echo, and seems correct as it's the time it takes from the echo to the one-liner.
But if I try to pass the variable as I wrote in the one-liner, it errors out. Really no idea what's wrong in the string... I'm maybe missing out something obvious (and stupid once I figure it out) but right now I'm not seeing it.
Timestamp for oauth should be the seconds since epoch, correct? And this in linux is created using date +%s as in the script.
Thanks for the help. Luca
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/tripit/api/issues/158#issuecomment-211542528
It's in the opening post, anyway:
curl -X POST -d "oauth_consumer_key=${key}&secret=${secret}&oauth_nonce=${O_nonce}&oauth_timestamp=${O_timestamp}" https://api.tripit.com/oauth/request_token
Timestamp is obtained using:
O_timestamp () {
echo "$(gdate +%s)"
}
As I've tried also to use gdate from homebrew instead of mative Mac date, but they give the same output.
I guess what I am asking for is what is the actual curl request when the values like ${O_timestamp} are replaced with the actual values. I was to see what is missing from the created curl request.
The timestamp should look like: @oauth_timestamp=1461097527
Thanks,
Vicki
On Mon, Apr 18, 2016 at 1:26 PM, dellock6 notifications@github.com wrote:
It's in the opening post, anyway:
curl -X POST -d "oauth_consumer_key=${key}&secret=${secret}&oauth_nonce=${O_nonce}&oauth_timestamp=${O_timestamp}" https://api.tripit.com/oauth/request_token
Timestamp is obtained using:
O_timestamp () {
Return timestamp
echo "$(gdate +%s)" }
As I've tried also to use gdate from homebrew instead of mative Mac date, but they give the same output.
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/tripit/api/issues/158#issuecomment-211562687
Ok, got it. I tried to write a curl with a fixed timestamp:
curl -X POST -d "oauth_consumer_key=${key}&secret=${secret}&oauth_nonce=${O_nonce}&oauth_timestamp=1461097955" https://api.tripit.com/oauth/request_token
Timestamp is like 10 seconds old, but still I receive the same error:
401
Ok. Thanks. Let me investigate further.
Vicki
On Tue, Apr 19, 2016 at 1:34 PM, dellock6 notifications@github.com wrote:
Ok, got it. I tried to write a curl with a fixed timestamp:
curl -X POST -d "oauth_consumer_key=${key}&secret=${secret}&oauth_nonce=${O_nonce}&oauth_timestamp=1461097955" https://api.tripit.com/oauth/request_token
Timestamp is like 10 seconds old, but still I receive the same error:
401105.100000oauth timestamp invalid: (1461097984)
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/tripit/api/issues/158#issuecomment-212116539
Your curl request is not correct. You do not need to include the &secret, but need to generate an oath_signature using HMAC-SHA1. This signature needs to be included in the request. Below is an excerpt from the API documentation.
Please see http://tripit.github.io/api/doc/v1 for more information on using oauth.
Step 1: Obtaining a Request Token (Section 6.1 http://oauth.net/core/1.0/#auth_step1)
To obtain a request token POST the following request parameters to the URL:
https://api.tripit.com/oauth/request_token
parameter nameparameter description oauth_consumer_key The Consumer's public key. oauth_nonce A nonce no more than 80 characters in length. oauth_signature The signature of the request. The algorithm to sign the request is described in the OAuth specification and examples can be found in the reference implementations. oauth_signature_method The method used to generate the method signature. Current supported methods are HMAC-SHA1. oauth_timestamp The timestamp in seconds since the epoch given in UTC. Note that the server will respond with a 401 (unauthorized) if the timestamp supplied by the client is more than +/- 3 hours from what the server considers the current time. oauth_version OPTIONAL - Assumed to be '1.0'
Thanks,
Vicki
On Tue, Apr 19, 2016 at 2:48 PM, Vicki Wisuri vwisuri@gmail.com wrote:
Ok. Thanks. Let me investigate further.
Vicki
On Tue, Apr 19, 2016 at 1:34 PM, dellock6 notifications@github.com wrote:
Ok, got it. I tried to write a curl with a fixed timestamp:
curl -X POST -d "oauth_consumer_key=${key}&secret=${secret}&oauth_nonce=${O_nonce}&oauth_timestamp=1461097955" https://api.tripit.com/oauth/request_token
Timestamp is like 10 seconds old, but still I receive the same error:
401105.100000oauth timestamp invalid: (1461097984)
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/tripit/api/issues/158#issuecomment-212116539
Hi, I'm working on a simple bash script (on mac os x) to grab different informations from tripit API, but I canàt get past the request token, as I constantly receive this error:
401
Timestamp is created using:
timestamp=$(date +%s)
and the complete string is this:
curl -X POST -d "oauth_consumer_key=${key}&secret=${secret}&oauth_timestamp=${timestamp}&oauth_nonce=${OAuth_nonce}" https://api.tripit.com/oauth/request_token
key and secret are passed correctly as I've tried to remove them and API returns the error about those missing. But I can't get pass the timestamp.
Thanks, Luca