如何处理Twitter身份验证?

如何处理Twitter身份验证?,twitter,laravel-4,Twitter,Laravel 4,我正在尝试在一个webapp中集成一个功能,用户点击一个按钮来推特webapp有多棒。(我知道,我知道,愚蠢,但是嘿,老板想要它) 我使用Thujohn的Twitter为Laravel 4设置了以下路线- 然而,我真的不知道在这一部分我应该做什么: // $credentials contains the Twitter user object with all the info about the user. // Add here your own user logic, store pro

我正在尝试在一个webapp中集成一个功能,用户点击一个按钮来推特webapp有多棒。(我知道,我知道,愚蠢,但是嘿,老板想要它)

我使用Thujohn的Twitter为Laravel 4设置了以下路线-

然而,我真的不知道在这一部分我应该做什么:

// $credentials contains the Twitter user object with all the info about the user.
// Add here your own user logic, store profiles, create new users on your tables...you name it!
// Typically you'll want to store at least, user id, name and access tokens
// if you want to be able to call the API on behalf of your users.

// This is also the moment to log in your users if you're using Laravel's Auth class
// Auth::login($user) should do the trick.

我需要做什么来确保用户不需要每次都对自己进行身份验证?

如果检查$credentials对象,应该会看到oauth访问令牌。将它们与您的用户数据(用户名、电子邮件、姓名等)一起保存在数据库中,您可以在下次调用twitter API时使用它们。

添加一个像ravelen/kint这样的包来Inspect完整类——它们可能不是公共属性,只能通过getToken()或类似方法使用。Kint转储将向您显示可用于提取此信息的可用方法。
// $credentials contains the Twitter user object with all the info about the user.
// Add here your own user logic, store profiles, create new users on your tables...you name it!
// Typically you'll want to store at least, user id, name and access tokens
// if you want to be able to call the API on behalf of your users.

// This is also the moment to log in your users if you're using Laravel's Auth class
// Auth::login($user) should do the trick.