我已经集成了混合和拉里,并能够登录到我的应用程序使用twitter使用杂交瘤。当我第一次用twitter登录我的应用程序时,我已经授权了我的应用程序。因此,通常下一次之后,我不需要授权我的应用程序登录,因为我已经接受了授权第一次。
但这是不可能的。每当我尝试登录twitter时,我的应用程序都会被推特强制授权。
我正在本地主机上试用这个。我需要在现场服务器上查一下吗?
我正在使用此代码,所有凭据都设置为:
Route::get('social/{action?}', array("as" => "hybridauth", function($action = "")
{
// check URL segment
if ($action == "auth") {
// process authentication
try {
Hybrid_Endpoint::process();
}
catch (Exception $e) {
// redirect back to http://URL/social/
return Redirect::route('hybridauth');
}
return;
}
try {
// create a HybridAuth object
$socialAuth = new Hybrid_Auth(app_path() . '/config/hybridauth.php');
// authenticate with Google
$provider = $socialAuth->authenticate("Twitter");
// fetch user profile
$userProfile = $provider->getUserProfile();
}
catch(Exception $e) {
// exception codes can be found on HybBridAuth's web site
return $e->getMessage();
}
// access user profile data
echo "Connected with: <b>{$provider->id}</b><br />";
echo "As: <b>{$userProfile->displayName}</b><br />";
echo "<pre>" . print_r( $userProfile, true ) . "</pre><br />";
// logout
$provider->logout();
}));发布于 2014-09-10 06:49:56
我已经找到了解决办法。它不是在代码中来修复某些东西。这是twitter应用程序的设置。为了避免这种问题,您应该从应用程序设置的Read and Write部分选择Read, Write and Access direct messages选项,而不是Read, Write and Access direct messages选项。
如果您选择Read, Write and Access direct messages,那么无论何时您尝试通过twitter应用程序登录应用程序,twitter都会提示您授权应用程序。有关更清楚的信息,请参见图像波纹图。
希望它能帮到你。谢谢

https://stackoverflow.com/questions/25701452
复制相似问题