Coinbase 无效 404 请求 OAuth2 Guzzle

我尝试使用 OAuth2 在 coinbase 中进行授权:


        $client = new Client(['cookies' => true]);

        try {

            $response = $client->request('POST', $this->urlAccessToken, [

                'headers' => [

                    'cache-control' => 'no-cache',

                    'Content-Type' => 'application/x-www-form-urlencoded'

                ],

                'form_params' => [

                    'grant_type' => 'authorization_code',

                    'code' => $request->code,

                    'client_id' => $this->clientId,

                    'client_secret' => $this->clientSecret,

                    'redirect_uri' => $this->redirectUri

                ]

            ]);

            dd($response->getBody());

        } catch (\Exception $e) {

            return response($e->getMessage(), 400);

        }

在 coinbase 中授权后,我重定向到重定向 URI,当发送请求交换代码时,我看到错误的响应:


客户端错误:POST http://www.coinbase.com/oauth/token导致404 Not Found响应:请求无效。您应该使用有效的 POST 参数发出 POST,而不是 GET 请求。欲了解更多信息(截断...)


一只斗牛犬
浏览 68回答 1
1回答

红糖糍粑

问题出在 URL 访问令牌中,需要https://api.coinbase.com/oauth/token改用http://www.coinbase.com/oauth/token。
打开App,查看更多内容
随时随地看视频慕课网APP