diff --git a/README.md b/README.md index ea612a5b..493e41ed 100644 --- a/README.md +++ b/README.md @@ -82,12 +82,27 @@ Bigcommerce::configure(array( ~~~ ### OAuth + +In order to obtain the auth_token you would consume `Bigcommerce::getAuthToken` method + ~~~php + +$object = new \stdClass(); +$object->client_id = 'xxxxxx'; +$object->client_secret = 'xxxxx; +$object->redirect_uri = 'https://app.com/redirect'; +$object->code = $request->get('code'); +$object->context = $request->get('context'); +$object->scope = $request->get('scope'); + +$authTokenResponse = Bigcommerce::getAuthToken($object); + Bigcommerce::configure(array( 'client_id' => 'xxxxxxxx', - 'auth_token' => 'xxxxxxx', + 'auth_token' => $authTokenResponse->access_token, 'store_hash' => 'xxxxxxx' )); + ~~~ Connecting to the store diff --git a/src/Bigcommerce/Api/Client.php b/src/Bigcommerce/Api/Client.php index 2c106449..7ac47cc9 100644 --- a/src/Bigcommerce/Api/Client.php +++ b/src/Bigcommerce/Api/Client.php @@ -413,7 +413,6 @@ public static function getAuthToken($object) { $context = array_merge(array('grant_type' => 'authorization_code'), (array)$object); $connection = new Connection(); - $connection->useUrlEncoded(); return $connection->post(self::$login_url . '/oauth2/token', $context); }