I need some help connecting to deviantArt's API for whois.
I am building a Laravel app that needs to connect to deviantArt's API.
I am able to successfully connect to the API using Socialite, The League's OAuth2-Client, Guzzle and cUrl, but only for a whoami request.
GET /user/whoami
I can make a successful whois
connect, but only using cUrl.
POST /user/whois
curl https://www.deviantart.com/api/v1/oauth2/user/whois \
-d "usernames[0]=justgalym" \
-d access_token=Alph4num3r1ct0k3nv4lu3
I'd like to stay using as much of the OAuth2-Client plugin as possible, but at this point, I am just looking for something that works.
My best guess is that I am not sending over the POST
variables correctly.
Attempt 1 - Using Guzzle Request
$options = [
'form_params' => [
'usernames[0]' => 'justgalym',
'expand' => 'user.profile',
],
"Authorization" => "Bearer ".$this->token->getToken()
];
$request = new Request('POST', $url, $options);
Attempt 2 - Using Guzzle Request
$options = [
'form_params' => [
'usernames[]' => 'justgalym',
'expand' => 'user.profile',
],
"Authorization" => "Bearer ".$this->token->getToken()
];
$request = new Request('POST', $url, $options);
Attempt 3 - Using Guzzle Request
$options = [
'form_params' => [
'usernames' => 'justgalym',
'expand' => 'user.profile',
],
"Authorization" => "Bearer ".$this->token->getToken()
];
$request = new Request('POST', $url, $options);
Attempt 4 - Using Guzzle Request
$options = [
'form_params' => [
'usernames' =>
[0 => 'justgalym'],
'expand' => 'user.profile',
],
"Authorization" => "Bearer ".$this->token->getToken()
];
$request = new Request('POST', $url, $options);
Attempt 5 - Using Oauth-client getAuthenticatedRequest
$request = $this->provider->
getAuthenticatedRequest(
AbstractProvider::METHOD_POST,
$url, $this->token, ['body' => 'usernames[0]=justgalym'
]);
Attempt ...
and many others
Result for all attempts give me the same error.
array(
'error' => 'invalid_request',
'error_description' => 'Request field validation failed.',
'error_details' =>
array(
'usernames' => 'usernames is required'
),
'status' => 'error'
)