invalid_client when trying to obtain Access & Refresh Tokens

412 views
Skip to first unread message

Pavel Obrtlík

unread,
Apr 23, 2018, 6:31:22 AM4/23/18
to Clio Developers
Good afternoon,

I am trying to integrate support for Clio in our PHP web application, but I am unable to obtain access and refresh token during autentication.

I managed to display sign in page, user allows access, then the browser window is redirected to my callback where i have authorization_code. But now, when I try to use this code to obtain access token, every request throws the following error:


{"error":"invalid_client","error_description":"The client identifier provided is invalid, the client failed to authenticate, the client did not include its credentials, provided multiple client credentials, or used unsupported credentials type."}

As a developer I activated one week trial to get access to Clio. 

There is an image in attachement containing query of link, which I am requesting. There is also one HTTP header containing Content-type: application/x-www-form-urlencode.

What am I doing wrong, that Clio doesn't want to get me Access Tokens?
Snímek z 2018-04-23 12-26-08.png

a...@yocierge.com

unread,
Apr 23, 2018, 1:08:13 PM4/23/18
to Clio Developers
Hi,

 I am using oauth2/ client lib for php.

...
protected $app_key = '';
protected $app_secret = '';
protected $authorozation_endpoint = 'https://app.clio.com/oauth/authorize';
protected $deauthorozation_endpoint = 'https://app.clio.com/oauth/deauthorize';
protected $token_endpoint = 'https://app.clio.com/oauth/token';
protected $api_uri = 'https://app.clio.com/api/v4/';
...
...
$this->client = new OAuth2\Client($this->app_key, $this->app_secret);
...
if (!isset($_GET['code'])){
$auth_url = $this->client->getAuthenticationUrl($this->authorozation_endpoint, $this->redirect_uri);
header('Location: ' . $auth_url);
die('Redirect');
} else {
$params = array(
'code' => $_GET['code'],
'redirect_uri' => $this->redirect_uri,
'client_id' => $this->app_key
);
$response = $this->client->getAccessToken($this->token_endpoint, 'authorization_code', $params);
if (isset($response['result']) && is_array($response['result'])){
if (isset($response['result']['access_token'])){$this->access_token = $response['result']['access_token'];}
if (isset($response['result']['refresh_token'])){$this->refresh_token = $response['result']['refresh_token'];}
if (isset($response['result']['token_type'])){$this->access_token_type = $response['result']['token_type'];}
}
if (!$this->access_token){
$this->log .= __METHOD__. ' no access token ';
return false;
}
$this->client->setAccessToken($this->access_token);
...

Hope this helps.

Attila

Pavel Obrtlík

unread,
Apr 24, 2018, 2:04:08 AM4/24/18
to Clio Developers
Someone suggested that I should double check the client id and client secret, so when double checking I found that if I mistype the client ID, then I won't get code from oauth/authorization url - because the request ends in "bad request".

I now think, that the whole problem is caused by this bold note:

Please note that only accounts on a Boutique or Elite pricing plan can create apps or access applications not listed in the Clio Marketplace.


in https://app.clio.com/api/v4/documentation#section/Getting-Started , and free trial isn't one of paid plans. And newly created application is not also in Clio Marketplace.


Was/Is there someone with free trial and working autentication to app not listed in Clio Marketplace?

Reply all
Reply to author
Forward
0 new messages