And this returns a token. But that token does not work. It gives an ID of null in the SDK when making a call.
Specifically:
Uncaught InvalidArgumentException: Missing the required parameter $id when calling id in \vendor\dwolla\dwollaswagger\lib\AccountsApi.php:72
If I use a token generated in the Sandbox, then it DOES work (calling Root).
Many other people seem to have posted this issue, with no response:
I have studied this page:
And I can’t find what I am doing wrong. If anyone has a working example of code, or can lend any assistance I would be grateful.
spencer
(Spencer Hunter - Lead Developer Advocate @ Dwolla)
2
Hi @CLEE, We do have plans to update the existing php swagger client to support making auth related requests to the API. In the meantime, you’ll want to use an external HTTP client for making this specific request. I’d highly recommend taking a look at Guzzle for doing this as it makes it very easy to send HTTP requests. It’ll look something like the following:
<?php
require('autoload.php');
use GuzzleHttp\Client;
$client = new GuzzleHttp\Client(['base_uri' => 'https://api-sandbox.dwolla.com']);
// make a request to the token url
$response = $client->request('POST', '/token', [
'auth' => [
'CLIENTID',
'CLIENTSECRET'
],
'form_params' => [
'grant_type' => 'client_credentials'
]
]);
$responseBody = $response->getBody(true);
$responseArr = json_decode($responseBody, true);
$accessToken = $responseArr['access_token'];
?>