Anvard HybridAuth Laravel实现 - 无法重定向到空URL

时间:2013-07-21 11:36:15

标签: laravel hybridauth

使用Anvard的HybridAuth L4软件包:

我完成所有这些并成功尝试并在我的localhost上完成了LinkedIn注册。

用户和配置文件表中的记录集已成功插入但我收到InvalidArgumentException:无法重定向到空URL

有什么想法吗?是因为我还没有投入使用路线:/ anvard / endpoint?我在哪里指定这个?在LinkedIn应用程序详细信息?

抓住稻草我将MAMP端口从8888改回80,因为我认为它可能与HybridAuth中的base_url有关,但是没有做任何事情。

在src / routes.php目录中,它似乎到达

Log::debug('Anvard: login success');
Auth::loginUsingId($profile->user->id);

然后 InvalidArgumentException

无法重定向到空网址。

非常感谢

乔恩

2 个答案:

答案 0 :(得分:2)

在Anvard路线档案[anvard / src / Atticmedia / Anvard / routes.php]

更改
return Redirect :: back(); 重定向到你想要某人去的实际路线。

答案 1 :(得分:1)

首先编辑你的/app/anvar/config/routes.php看起来像这样:

<?php
return array(
    'index' => 'login',
    'login' => 'login/{provider}',
    'endpoint' => 'after/facebook',
/* note that endpoint can not be the same pattern as login
for example if I made it login/after it would go back to the login page with 'after' as $provider
*/
        );

app/storage/logs/中创建一个文件,然后将其命名为hauth_debug_file.txt 将以下内容添加到/config/packages/anvard/hybridauth.php

"debug_mode" => true,
"debug_file" =>"D:\www\Dev\bp4\app\storage\logs\hauth_debug_file.txt",
//change this path with yours 

这将为文件中的调试转储很多好的信息,然后您可以共享该文件以帮助解决问题。所以你的文件看起来像这样:

<?php
return array(

    // 'base_url' => URL::route(Config::get('anvard::routes.login')),

    'providers' => array (


        'Facebook' => array (
            'enabled' => true,
            'keys'    => array ( 'id' => 'yourr-key', 'secret' => 'your-secret' ),
            //'scope'  => Input::get('permission_scope','email, user_about_me, user_birthday, user_hometown, user_likes, user_interests, user_location'),
        ),

        'Twitter' => array (
            'enabled' => false,
            'keys'    => array ( 'key' => '', 'secret' => '' )
        ),

        'LinkedIn' => array (
            'enabled' => false,
            'keys'    => array ( 'key' => '', 'secret' => '' )
        ),
    ),
    "debug_mode" => true,
    "debug_file" =>"D:\www\Dev\bp4\hauth_debug_file.txt",

);

或者,您可以通过/app/start/local.php中的config :: set设置此配置 同样在/anvard/src/Atticmedia/Anvard/routes.php我认为如果你将return Redirect::back();改为return Redirect::to(Config::get('anvard::routes.endpoint'));

会更好

我还必须在第230行编辑Atticmedia / Anvard / Anvard.php

$profile = new $ProfileModel();
        foreach ($attributes as $key => $v) {
            $profile->$key = $v;
        }
        $profile = $this->applyAdapterProfileToExistingProfile($adapter_profile, $profile);