Does anyone have or know of working PHP code to complete an oAuth API integration request flow? I've gotten past the activation step, and my application has the following information
[oauth_consumer_key] => x...0
[oauth_consumer_secret] => j...l
[store_base_url] => http://magento.example.com/
[oauth_consumer_secret] => 5...n
According to the docs, I'm supposed to use this information to make an oAuth request to
/oauth/token/request
for a temporary request token, and then use that temporary request token to fetch a longer term access token from
/oauth/token/access
and this longer term access token can be used to make API requests.
Or -- so I assume. The docs are a bit cryptic on this.
For example, this section makes mention of the parameters to use for the request to /oauth/token/request
, but doesn't provide what the oAuth version should be, nor how the oauth_signature
parameter should be generated. It's also a little confusing when talking about the values you need to send once you have your tokens -- as I'd expect to see a secret in there.
Finally, the checklogin.php
code from dev docs makes use of two classes, OAuth\Common\Consumer\Credentials
and OauthClient
.
$credentials = new \OAuth\Common\Consumer\Credentials($consumerKey, $consumerSecret, $magentoBaseUrl);
$oAuthClient = new OauthClient($credentials);
The first seems to be part of the lusitanian/oauth
composer package, which is easy enough to use. However -- the OauthClient
seems to be part of Magento's API testing framework, which makes it not trivial or obvious how to use it.
I know I can also use my admin username or customer session as API credentials. I'm specifically interested in API Integrations.