Skip to content

Commit 7d1504f

Browse files
author
Alyss Noland
authored
Merge pull request #193 from gayanhewa/FixGetAuthToken
Fix the get auth token and update the README
2 parents 9d66413 + 89ac39c commit 7d1504f

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,27 @@ Bigcommerce::configure(array(
8282
~~~
8383

8484
### OAuth
85+
86+
In order to obtain the auth_token you would consume `Bigcommerce::getAuthToken` method
87+
8588
~~~php
89+
90+
$object = new \stdClass();
91+
$object->client_id = 'xxxxxx';
92+
$object->client_secret = 'xxxxx;
93+
$object->redirect_uri = 'https://app.com/redirect';
94+
$object->code = $request->get('code');
95+
$object->context = $request->get('context');
96+
$object->scope = $request->get('scope');
97+
98+
$authTokenResponse = Bigcommerce::getAuthToken($object);
99+
86100
Bigcommerce::configure(array(
87101
'client_id' => 'xxxxxxxx',
88-
'auth_token' => 'xxxxxxx',
102+
'auth_token' => $authTokenResponse->access_token,
89103
'store_hash' => 'xxxxxxx'
90104
));
105+
91106
~~~
92107

93108
Connecting to the store

src/Bigcommerce/Api/Client.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,6 @@ public static function getAuthToken($object)
413413
{
414414
$context = array_merge(array('grant_type' => 'authorization_code'), (array)$object);
415415
$connection = new Connection();
416-
$connection->useUrlEncoded();
417416

418417
return $connection->post(self::$login_url . '/oauth2/token', $context);
419418
}

0 commit comments

Comments
 (0)