use FDOAuth\FDOAuth; // create a new FDOAuth object $auth = new FDOAuth(); // set the credentials $auth->setCredentials('consumer_key', 'consumer_secret'); // set the scope $auth->setScope('data:read'); // obtain the access token $token = $auth->getAccessToken(); echo $token;
use FDOAuth\FDOAuth; use GuzzleHttp\Client; // create a new FDOAuth object $auth = new FDOAuth(); // set the credentials $auth->setCredentials('consumer_key', 'consumer_secret'); // set the scope $auth->setScope('data:read'); // obtain the access token $token = $auth->getAccessToken(); // create a new Guzzle HTTP client $client = new Client(); // make an authorized API request using the access token $response = $client->request('GET', 'https://api.financialdata.io/v1/search?q=apple', [ 'headers' => [ 'Authorization' => 'Bearer ' . $token, 'Content-Type' => 'application/json' ] ]); echo $response->getBody();The package/library used in these examples is FDOAuth.