(07-20-2022, 06:15 AM)GeorgeBairaktaris Wrote: Ok.
Postman.
Get method:http://charalampidis.globaltouchdev.eu/wp-json/wc/v2/orders
Authorization : 0Auth1
Consumer Key :ck_399bad935831bff0bc342e8edd3f47a14f1fa63b[color=#212121]
Consumer Secret :cs_d193e669d87da71f46a6ea827d26a0a97adae9f6[color=#212121]
I meant, the RAW request that Postman actually transmits.
In any case, have you tried sending the OAuth credentials in the HTTP "Authorization" request header instead of as URL query parameters?
Note that OAuth 1 uses a 3-step authentication process, so it takes multiple requests to be able to access the resource you want. It would look something like this:
Code:
idHttp.Request.UserAgent := 'Mozilla/5.0 (Windows NT x.y; rv:10.0) Gecko/20100101 Firefox/10.0';
idhttp.Request.CustomHeaders.AddValue('Cookie', 'PHPSESSID=c4ec7f957fe429e2f8ca2cc6a641469f');
idhttp.Request.CustomHeaders.Values['Authorization'] :=
'OAuth realm="...", ' +
'oauth_consumer_key="...", ' +
'oauth_signature_method="HMAC-SHA1", ' +
'oauth_timestamp="...", ' +
'oauth_nonce="...", ' +
'oauth_callback="...", ' +
'oauth_signature="..."';
idhttp.Post('https://charalampidis.globaltouchdev.eu/oauth1/request');
// extract oauth_token and oauth_token_secret from response...
idhttp.Get(''https://charalampidis.globaltouchdev.eu/oauth1/authorize?oauth_token=...&oauth_callback=...');
// extract oauth_token and oauth_verifier from response...
idhttp.Request.CustomHeaders.Values['Authorization'] :=
'OAuth realm="...", ' +
'oauth_consumer_key="...", ' +
'oauth_token="...", ' +
'oauth_signature_method="HMAC-SHA1", ' +
'oauth_timestamp="...", ' +
'oauth_nonce="...", ' +
'oauth_verifier="...", ' +
'oauth_signature="..."';
idhttp.Post('http://charalampidis.globaltouchdev.eu/oauth1/access');
// extract oauth_token and oauth_token_secret from response...
// NOW, you can send further REST requests as needed,
// using the latest oauth_token and oauth_token_secret to sign the
// Authorization header...
idhttp.Request.CustomHeaders.Values['Authorization'] :=
'OAuth realm="...", ' +
'oauth_consumer_key="...", ' +
'oauth_token="...", ' +
'oauth_signature_method="HMAC-SHA1", '+
'oauth_timestamp="...", '+
'oauth_nonce="...", ' +
'oauth_signature="..."';
idhttp.Get('http://charalampidis.globaltouchdev.eu/wp-json/wc/v2/orders');
...
You should read https://oauth1.wp-api.org/docs/basics/Auth-Flow.html and https://blog.erikthe.red/2017/11/24/enab...wordpress/ for more details about how to use OAuth 1 with WordPress.