使用带有facebook的Socialite的OAuthException - “message”:“必须使用活动访问令牌来查询有关当前用户的信息。”,

时间:2017-03-27 23:29:23

标签: laravel oauth-2.0 laravel-socialite

我一直在使用社交网站几天没有问题。今天,我开始收到此错误。

{ "error": 
    { 
       "message": "An active access token must be used to query information 
        about the current user.", "type": "OAuthException",
        "code": 2500, "fbtrace_id": "FTvIz9t1LT+"
   }
}

错误似乎很简单,但我似乎无法在线看到解决方案。有没有办法使用Socialite重置我的access_token。

请注意:我几乎遵循了tutorial

当我尝试获取

时,错误发生在回调中
$userProvider try { 
    $userProvider = Socialite::driver('facebook')->user();
} catch (Exception $e) {
   Log::info('Callback Error ' . $e->getMessage());
   return Redirect::to('redirect');
}

谢谢,Rich

3 个答案:

答案 0 :(得分:30)

这也发生在我身上。我修复了它composer update然后composer dump-autoload。这会将Socialite更新为v2.0.21

干杯

答案 1 :(得分:4)

这是因为Facebook API的v2.2不再可用。更新laravel / socialite包:

let person = document.createElement('person'); let name = document.createElement('name'); let surname = document.createElement('surname'); person.appendChild(name); person.appendChild(surname); let xml = `<?xml version="1.0" encoding="UTF-8"?>${person.outerHTML}`; let file = new File([xml] , "xmlfile.xml", {type:"application/xml"}); console.log(person, xml, file); let url; window.onload = () => { let a = document.createElement("a"); let filename = "xmlfile.xml"; a.download = a.textContent = "xmlfile.xml"; url = URL.createObjectURL(file); a.href = url; document.body.appendChild(a); a.onclick = () => { window.onfocus = () => { window.onfocus = null; URL.revokeObjectURL(url); if ("close" in file && !file.isClosed) file.close(); } } }

这样它不会影响您的其他包。

答案 2 :(得分:2)

我认为问题是解析令牌所以更改这2行应该解决问题

https://github.com/laravel/socialite/pull/214/files#diff-b221dafd8a91f5753288a2d8603cef25