any one suggest or share code how to use OAuth 2 in order to use Clio api in php.
I got the client_id and client_secret part.
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);
Copyright © 2021 Jogjafile Inc.