GitHub访问令牌POST错误(需要cookie)


GitHub Acces Token POST Error (Cookies required)

我得到了一个PHP应用程序,我正试图与GitHub集成。在我从身份验证中获得代码并尝试用access_token交换它之后,我得到了以下错误

Cookies must be enabled to use GitHub.

我使用cURL库来执行我的请求。我设置的标题是

  • 内容长度:{长度}
  • 接受:application/json
  • user - agent: app

能帮我一下吗?

使用

/* cURL will start a new cookie session and ignore any previous cookies */
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
/* this is the name of the file where cURL should save cookie information */
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); 
// could be empty, but cause problems on some hosts