[英]Laravel Socialite: Invalid request. Missing OAuth verifier. (Twitter)
This is my first time working with Socialite and I can't seem to get it to work correctly.这是我第一次使用 Socialite,我似乎无法让它正常工作。
Essentially, all I want is to return some account details of the currently authenticated account.本质上,我想要的只是返回当前已验证帐户的一些帐户详细信息。 I have it working when it comes to logging in and creating an account but when I try to return details using that account I'm greeted with the missing OAuth verifier error.我在登录和创建帐户时可以正常工作,但是当我尝试使用该帐户返回详细信息时,我遇到了缺少 OAuth 验证程序的错误。
Here is a short video clip of my authorizing the app as expected and then clicking a link that should return JSON data about the account: https://youtu.be/LE8x9P8N_dU这是我按预期授权应用程序然后单击应返回有关帐户的 JSON 数据的链接的简短视频剪辑: https ://youtu.be/LE8x9P8N_dU
Inside the controller for returning the account details I have:在用于返回我拥有的帐户详细信息的控制器内部:
public function getAccountInfo(){
$socialAccount = Socialite::with('twitter')->user();
return $socialAccount;
}
I was under the impression this would let me do things such as我的印象是这会让我做一些事情,比如
$socialAccount->getAvatar();
ect however it doesn't appear to work.等等,但是它似乎不起作用。
I was following this tutorial for setting up Socialite: https://blog.damirmiladinov.com/laravel/laravel-5.2-socialite-twitter-login.html so my set up is almost exactly the same as this.我正在按照本教程设置 Socialite: https ://blog.damirmiladinov.com/laravel/laravel-5.2-socialite-twitter-login.html 所以我的设置几乎与此完全相同。
"laravel/framework": "5.4.*",
"laravel/socialite": "^3.0",
Any advice is greatly appreciated, I can provide any additional information you need please don't hesitate to ask for it.非常感谢任何建议,我可以提供您需要的任何其他信息,请随时提出要求。
Check this syntax检查此语法
$socialAccount = Socialite::driver('twitter')->user();
If you want the account details of the currently authenticated user, use the same old如果您想要当前经过身份验证的用户的帐户详细信息,请使用相同的旧
$user = Auth::user();
You can check... $request->exists('denied')
for Twitter and $request->exists('error')
for Linkedin.您可以检查... $request->exists('denied')
用于 Twitter 和$request->exists('error')
用于 Linkedin。 It working on my application in Laravel 6.0* with Socialite 4.0*.它适用于我在 Laravel 6.0* 和 Socialite 4.0* 中的应用程序。
if ($request->exists('denied') || $request->exists('error'))
{
// do something
}else{
$socialAccount = Socialite::driver($provider)->user();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.