Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not sure how to configure signature element #149

Open
LeonAdato opened this issue Sep 12, 2023 · 0 comments
Open

Not sure how to configure signature element #149

LeonAdato opened this issue Sep 12, 2023 · 0 comments

Comments

@LeonAdato
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant