thephpleague / oauth1-client

OAuth 1 Client
MIT License
968 stars 73 forks source link

Not sure how to configure signature element #149

Open LeonAdato opened 1 year ago

LeonAdato commented 1 year ago

Background/Context: I'm creating a simple php script that uses curl to retrieve info from a remote WooCommerce site via the API as a proof of concept.

Issue: I'm not seeing how to generate discrete oauth elements like signature

Specifics: using Postman, the curl command includes these parameters: CURLOPT_URL => 'http://MYWEBSITE/wp-json/wc/v3/ ?oauth_consumer_key=\<THE KEY> &oauth_signature_method=HMAC-SHA1 &oauth_timestamp=\<TIMESTAMP> &oauth_nonce=\<NONCE> &oauth_version=1.0 &oauth_signature=\<SIGNATURE>',

I can handle everything except the signature. Using the php oauth library, I would do this: $oauth = new OAuth($this->consumerKey,$this->consumerSecret); $oauth->setToken($this->token,$this->tokenSecret); $url = $this->'\<THE WEBSITE>'; $nonce = mt_rand(); $timestamp = time(); $oauth->setTimestamp($timestamp); $oauth->setNonce($nonce); $sig = $oauth->generateSignature('GET',$url);

I'm trying to model the same behavior with this library, but I can't see an example that grabs a signature. I'm probably just overlooking it.

THank you in advance!