Skip to content

Instantly share code, notes, and snippets.

@quickshiftin
Created April 26, 2018 15:29
Show Gist options
  • Save quickshiftin/da65b3b813ee055bf2d83063ee944e91 to your computer and use it in GitHub Desktop.
Save quickshiftin/da65b3b813ee055bf2d83063ee944e91 to your computer and use it in GitHub Desktop.
Example fetching an OAuth access token in Magento2
// Using thephpleague/oauth1-client
// https://github.com/thephpleague/oauth1-client
require_once __DIR__.'/../../vendor/autoload.php';
// Create server
$server = new League\OAuth1\Client\Server\Magento(array(
'identifier' => $data['consumerKey'],
'secret' => $data['consumerSecret'],
'callback_uri' => "http://mage-access.local/oath.php/",
));
$temporaryCredentials = $server->getTemporaryCredentials();
$server->getTokenCredentials($temporaryCredentials, $requestToken['oauth_token'], $requestToken['oauth_token_secret']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment