Laravel社交名媛:无效的请求.缺少OAuth验证程序. (推特) [英] Laravel Socialite: Invalid request. Missing OAuth verifier. (Twitter)

查看:122
本文介绍了Laravel社交名媛:无效的请求.缺少OAuth验证程序. (推特)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次与Socialite合作,我似乎无法使其正常工作.

This is my first time working with Socialite and I can't seem to get it to work correctly.

基本上,我只想返回当前已验证帐户的一些帐户详细信息.在登录和创建帐户时,它可以正常工作,但是当我尝试使用该帐户返回详细信息时,我会遇到丢失的OAuth验证程序错误.

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.

以下是我按预期授权应用程序的简短视频片段,然后单击一个链接,该链接应返回有关该帐户的JSON数据:

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

在控制器内部,用于返回我的帐户详细信息:

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,但是它似乎不起作用.

ect however it doesn't appear to work.

我正在按照本教程设置社交名流: https ://blog.damirmiladinov.com/laravel/laravel-5.2-socialite-twitter-login.html ,所以我的设置与此完全相同.

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.

"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.

推荐答案

检查此语法

$socialAccount = Socialite::driver('twitter')->user();

如果要使用当前已认证用户的帐户详细信息,请使用相同的旧

If you want the account details of the currently authenticated user, use the same old

$user = Auth::user();

这篇关于Laravel社交名媛:无效的请求.缺少OAuth验证程序. (推特)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆