guzzle을 사용하여 토큰 요청을하려고하는데 "400 Bad Request"응답을받습니다 : { "error ":"invalid_client "}". 나는 cURL과 HTTP_Request2로 아무런 문제없이 동일한 요청을 할 수있다.Guzzle - 400 Bad Request` 응답 : { "error": "invalid_client"} - 토큰 요청을 할 때
URL : https://identity.reckon.com/connect/token
유형 : POST
바디 : grant_type = authorization_code & 코드 = {코드
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\Request;
session_start();
if(isset($_GET['code'])){
$code = $_GET['code'];
$encodeB64 = base64_encode('{clientID}:{clientSecret}');
$client = new GuzzleHttp\Client();
$response = $client->request('POST', 'https://identity.reckon.com/connect/token',[
['headers' => ['Content-Type' => 'application/x-www-form-urlencoded'],['Authorization' => 'Basic '.$encodeB64]],
['body' => ['grant_type' => 'authorization_code'],['code' => $code],['redirect_uri' => '{redirectURI}']]
]);
$body = $response->getBody();
echo $body;
}
이
이 API와 토큰 요청을하는 방법의 세부 사항입니다 } & redirect_uri = {리디렉션 url}헤더 :
콘텐츠 유형 = 응용 프로그램/x-www-form-urlencoded를
인증 : 기본 : 난 곳 확실하지 {클라이언트 ID를 base64로 인코딩 클라이언트 비밀}
잘못되어가는.
시도 [및] 그 단지 표현입니다 또는 코드 내에서 실제로 구현되는 방법은 무엇입니까? –