Updating oauth.php file to match the new base api

This commit is contained in:
Bruno F. Fontes 2019-06-25 18:08:21 -03:00
parent 13fadfe9ae
commit 97e0a56b65
Signed by: brunofontes
GPG Key ID: EE3447CE80048495

View File

@ -5,9 +5,10 @@
* @author Bruno Fontes <developer@brunofontes.net> * @author Bruno Fontes <developer@brunofontes.net>
* @link https://github.com/brunofontes * @link https://github.com/brunofontes
*/ */
namespace BrunoFontes\Memsource; namespace BrunoFontes\Memsource;
class Oauth extends \BrunoFontes\Memsource class Oauth extends \BrunoFontes\Memsource\FetchApi
{ {
private $_url = '/oauth'; private $_url = '/oauth';
@ -37,10 +38,7 @@ class Oauth extends \BrunoFontes\Memsource
CURLOPT_POST => true, CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $content CURLOPT_POSTFIELDS => $content
]; ];
$response = $this->curl($token_url, $params); $response = json_decode($this->curl($token_url, $params), true);
if ($respose['error']) {
throw new Exception("Error getting access token", 1);
}
return $response['access_token']; return $response['access_token'];
} }
} }