Laravel社交名流和SPA登录

时间:2017-10-08 03:04:20

标签: oauth-2.0 vue.js facebook-login laravel-socialite

我正在使用SOCKET listenSocket = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP); if (listenSocket != INVALID_SOCKET) { BOOL off = FALSE; setsockopt(listenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&off, sizeof(off)); sockaddr_in6 addr = {}; addr.sin6_family = AF_INET6; addr.sin6_port = htons(7777); addr.sin6_addr = in6addr_any; bind(listenSocket, (sockaddr*) &addr, sizeof(addr)); listen(listenSocket, ...); } // use listening socket as needed... 以及vue.jslaravel,其文档可以找到here

我的前端正在vue-authenticate

后端的localhost:8080上运行

vue-authenticate config

127.0.0.1:8000

问题

当我点击使用Vue.use(VueAuthenticate, { baseUrl: 'http://127.0.0.1:8000', // Your API domain providers: { facebook: { clientId: '123456789', redirectUri: 'http://127.0.0.1:8000/facebook/callback', // Your client app URL scope: ['email', 'rsvp_event', 'public_profile', 'user_events'] } } }); 记录自己时出现此错误

  

客户端错误:Facebook导致POST https://graph.facebook.com/v2.9/oauth/access_token响应:{“error”:{“message”:“验证错误   验证码。请确保您的redirect_uri与之相同   你(截断...)

网址如下所示:

400
  Bad Request

问题

我该怎么做才能解决这个问题?

另外我不得不说我对回调函数有点困惑等等。我是否在适当的时候调用了正确的功能?

Laravel路线

http://127.0.0.1:8000/facebook/callback?code=AQCio_tQpGgfBUKrdBRqIFDMS9NJvaFXX4hhnyFhKylIoTmU27ciMHBZiojdJT5XA2pApaPsoRO3ocokWrDx-TEBTSOmWQErkcmbOEi6fUYUPtlfJfiYw-49NyKYEDq63akgEqDI2r2FeBrw2Wo8IjlchNZ7F_IcAIyJjstVYShCZAK3Beu_rNEPG-1M6wvLHqXbe2dhRQcW9TeE2dxtewK-MPEb3ffmmoX5bK9uyZrF-TTH4tpsOKI2S6HPpDy2wSasUcXCtdMJfV3TLFuFlq1H3pgza6nyvhy8Ln1OQYbRTT30uBaZWnUt7R3JQsfAxzM#_=_

功能

Route::get('auth/facebook', 'SocialAuthController@redirectToProviderApi');
Route::get('facebook/callback', 'SocialAuthController@handleProviderCallbackAPI');

1 个答案:

答案 0 :(得分:0)

您的Facebook API redirect_uri必须与您使用的API相同

http://127.0.0.1:8000/facebook/callback