iT邦幫忙

1

Laravel 使用 socialiteproviders/Line 要登入時報錯:Driver [Line] not supported

  • 分享至 

  • xImage

求助高手解答-> 我的設置流程如下:
#1

composer require socialiteproviders/line

#2 修改app/Providers/EventServiceProvider

protected $listen = [
    //...

    'SocialiteProviders\Manager\SocialiteWasCalled' => [
        'SocialiteProviders\Line\QqExtendSocialite@handle',
    ],
];

#3 .env中增加qq登录的key和秘钥

Line_KEY=164*****708
Line_SECRET=790f651*******ffb****80
Line_REDIRECT_URI=http://localhost:8000/auth/Line/callback

#4 config/services.php

'Line' => [
        'client_id' => env('Line_KEY'),
        'client_secret' => env('Line_SECRET'),
        'redirect' => env('Line_REDIRECT_URI'),
    ],

$5 php artisan make:controller Auth/SocialitesLineController

//...
use Socialite;

class SocialitesController extends Controller
{
    //跳转到QQ授权页面
    public function qq()
    {
        return Socialite::with('qq')->redirect();
    }

    //用户授权后,跳转回来
    public function callback()
    {
        $info = Socialite::driver('qq')->user();
        dump($info);
    }
}

#6 路由

Route::namespace('Auth')->prefix('auth/Line')->group(function () {
    Route::get('/', 'SocialitesLineController@Line');
    Route::get('callback', 'SocialitesLineController@callback');
});

#7 點按連結後出現 Driver [Line] not supported.
https://ithelp.ithome.com.tw/upload/images/20200223/20121754M0BVgd6B0t.png

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

1
firecold
iT邦新手 1 級 ‧ 2020-02-24 10:12:56
最佳解答

https://socialiteproviders.netlify.com/providers/line.html

參數大小寫要改

config/services.php

'line' => [
    'client_id' => env('LINE_KEY'),
    'client_secret' => env('LINE_SECRET'),
    'redirect' => env('LINE_REDIRECT_URI')
],

code哪來的....
你composer require socialiteproviders/line
結果with('qq')??
所以要底要用line第三方登入還是qq呢
還是你誤會第三方登入了呢

我真太不小心了!謝謝您細心提醒!我已經修正上述錯誤,繼續往下....謝謝您!

firecold iT邦新手 1 級 ‧ 2020-02-24 13:21:35 檢舉

不會, good luck

我要發表回答

立即登入回答