2
我目前正在嘗試通過PHP在用戶授權通過他的Discord帳戶登錄後收到用戶的Discord信息。授權和認證已經工作,所以access_token有效。OAuth2:錯誤401未授權的PHP請求與access_token(Discord API)
每次我發送請求,我收到一個401錯誤,看起來像這樣:
{"code": 0, "message": "401: Unauthorized"}
的PHP代碼是目前這一個:
$second_curl = curl_init('https://discordapp.com/api/users/@me');
curl_setopt($second_curl,CURLOPT_RETURNTRANSFER, true);
curl_setopt($second_curl, CURLOPT_HTTPHEADER, array("Authorization: BEARER ".$secret->access_token));
$me = curl_exec($second_curl);
echo $me;
隨着$我附和提到的錯誤響應。
我根本無法找到它的修復。有沒有人有關於OAuth2服務器的奇怪迴應的線索?