Skip to content

Instantly share code, notes, and snippets.

@joslynesser
Created April 10, 2012 15:39
Show Gist options
  • Save joslynesser/2352252 to your computer and use it in GitHub Desktop.
Save joslynesser/2352252 to your computer and use it in GitHub Desktop.
OAuth 1.0a Curl Request
# Replace oauth_consumer_key with your consumer key
# Replace oauth_token with your access token
# Replace oauth_signature with "your_consumer_secret%26your_access_token_secret"
# Note that the oauth_nonce must change and be unique for every request
curl -X GET 'https://yoursite.desk.com/api/v1/account/verify_credentials.json' -H 'Authorization: OAuth oauth_version="1.0",oauth_timestamp=1321473112,oauth_nonce=937459123,oauth_signature_method="PLAINTEXT",oauth_consumer_key="nMu4u9pLRfDrxhPVK5yn",oauth_token="ivouGxpsJbyIU5viPKOO",oauth_signature="vLr9MjzowzVwbvREpWhIVQMJQI0G7Pin6KHCoXak%26igQY0L2bcbwonZTC4kG5ulZxTMTDW0K0zIyceSuF"'
@bentcoder
Copy link

Hi joslynesser,

I'm trying to create my version of your command but don't quiet know how to generate oauth_token and your_access_token_secret in order to run it. Would you please tell me how to do that? All I have is array below if it helps.

Thanks

$oauth_consumer_key = '6481-6163-0300';
$consumer_secret = '3qrq46dabjokwsgk4owwk8k4scs00o400kccwc0gs4048k8css';
$oauth_nonce = md5(uniqid(mt_rand(), true));
$oauth_token = ?????????????????
$access_token_secret = ?????????????????
$oauth_signature = $consumer_secret . '%26' . $access_token_secret;
Array
(
    [consumerKey] => 6481-6163-0300
    [consumerSecret] => 3qrq46dabjokwsgk4owwk8k4scs00o400kccwc0gs4048k8css
    [nonce] => 3bdf692be4386acc033dbba7d3c1c740
    [timestamp] => 1425902208
    [oauthVersion] => 1.0
    [uri] => http://api.domain.com/1/account/status.json
    [params] => Array
        (
        )
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment