whois 用の deviantArt の API に接続するのに助けが必要です。
deviantArt の API に接続する必要がある Laravel アプリを構築しています。
Socialite、The League の OAuth2-Client、Guzzle 、および cUrlを使用して API に正常に接続できますが、whoami リクエストの場合のみです。
GET /ユーザー/whoami
接続は成功しますがwhois
、cUrl のみを使用します。
投稿/ユーザー/whois
curl https://www.deviantart.com/api/v1/oauth2/user/whois \
-d "usernames[0]=justgalym" \
-d access_token=Alph4num3r1ct0k3nv4lu3
できるだけ多くの OAuth2-Client プラグインを使い続けたいと思っていますが、現時点では機能するものを探しているだけです。
私の最善の推測は、POST
変数を正しく送信していないということです。
試行 1 - Guzzle リクエストの使用
$options = [
'form_params' => [
'usernames[0]' => 'justgalym',
'expand' => 'user.profile',
],
"Authorization" => "Bearer ".$this->token->getToken()
];
$request = new Request('POST', $url, $options);
試行 2 - Guzzle リクエストの使用
$options = [
'form_params' => [
'usernames[]' => 'justgalym',
'expand' => 'user.profile',
],
"Authorization" => "Bearer ".$this->token->getToken()
];
$request = new Request('POST', $url, $options);
試行 3 - Guzzle リクエストの使用
$options = [
'form_params' => [
'usernames' => 'justgalym',
'expand' => 'user.profile',
],
"Authorization" => "Bearer ".$this->token->getToken()
];
$request = new Request('POST', $url, $options);
試行 4 - Guzzle リクエストの使用
$options = [
'form_params' => [
'usernames' =>
[0 => 'justgalym'],
'expand' => 'user.profile',
],
"Authorization" => "Bearer ".$this->token->getToken()
];
$request = new Request('POST', $url, $options);
試行 5 - Oauth-client getAuthenticatedRequest の使用
$request = $this->provider->
getAuthenticatedRequest(
AbstractProvider::METHOD_POST,
$url, $this->token, ['body' => 'usernames[0]=justgalym'
]);
試み ...
その他多数
すべての試行の結果で同じエラーが発生します。
array(
'error' => 'invalid_request',
'error_description' => 'Request field validation failed.',
'error_details' =>
array(
'usernames' => 'usernames is required'
),
'status' => 'error'
)