B4J Question oauth for woocommerce (wordpress) .. how it works question.

iordanis lazoudis

Member
Licensed User
Hello,

I have a wordpress with woocommerce . I use the oauth library and i have a consumerKey and a consumerSecret.

Following a previous thread i did the following

B4X:
consumerKey = "aaaaaaaaaaaa"
    consumerSecret = "bbbbbbbbbbbbb"
    req.InitializeGet(url)
    auth.Initialize(consumerKey, consumerSecret)
    auth.Sign(req)

what follows next?

if i open a browser and call this url
https://MySite.com/wp-json/wc/v2/orders?consumer_key=consumerKey&consumer_secret=consumerSecret

i get the JSON I want.

How do i securely get it with oauth?

IF i open an httpjob and call the download method (with the above url) i get also the data, but i believe its not the right way since i am passing the consumerkey and secret in the url, right?

How do i do it with oauth ?

Thank you in advance
 

iordanis lazoudis

Member
Licensed User
Hello,

I am new to doing http requests and the whole json thing with oauth and i would appreciate guidance on what to use for better development. What is the difference between the two? Which one is better for using for my issue?

Also, a more general question, for all these libraries where do i find documentation on how to use them? And is there a central repository with all the libraries cause i search through the site for zip files from time to time.

Thank you for your time and efforts

Jordan
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Also, a more general question, for all these libraries where do i find documentation on how to use them? And is there a central repository with all the libraries cause i search through the site for zip files from time to time.
Use the search engine: https://www.b4x.com/android/forum/pages/results/?query=oauth&prefix=1,2,3,17,24,29

Tutorials about web services: https://www.b4x.com/android/forum/threads/b4x-okhttputils2-with-wait-for.79345/#content (watch the video)

The old OAuth library is a B4A library that works with the old Http library. It will not work with OkHttp and I'm not sure whether it will work with B4J jHttp library.
Most web services use OAuth 2 now which is handled differently.
 
Upvote 0
Top