<i id='nZD48'><tr id='nZD48'><dt id='nZD48'><q id='nZD48'><span id='nZD48'><b id='nZD48'><form id='nZD48'><ins id='nZD48'></ins><ul id='nZD48'></ul><sub id='nZD48'></sub></form><legend id='nZD48'></legend><bdo id='nZD48'><pre id='nZD48'><center id='nZD48'></center></pre></bdo></b><th id='nZD48'></th></span></q></dt></tr></i><div id='nZD48'><tfoot id='nZD48'></tfoot><dl id='nZD48'><fieldset id='nZD48'></fieldset></dl></div>
    1. <legend id='nZD48'><style id='nZD48'><dir id='nZD48'><q id='nZD48'></q></dir></style></legend>

      1. <small id='nZD48'></small><noframes id='nZD48'>

        <tfoot id='nZD48'></tfoot>

          <bdo id='nZD48'></bdo><ul id='nZD48'></ul>
      2. Laravel Socialite Facebook 错误:“POST https://graph.facebook.c

        Laravel Socialite Facebook error: quot;POST https://graph.facebook.com/oauth/access_token resulted in a `400 Bad Request` quot;(Laravel Socialite Facebook 错误:“POST https://graph.facebook.com/oauth/access_token 导致‘400 错误请求’) - IT

        <small id='9JSlt'></small><noframes id='9JSlt'>

          <tbody id='9JSlt'></tbody>

        <i id='9JSlt'><tr id='9JSlt'><dt id='9JSlt'><q id='9JSlt'><span id='9JSlt'><b id='9JSlt'><form id='9JSlt'><ins id='9JSlt'></ins><ul id='9JSlt'></ul><sub id='9JSlt'></sub></form><legend id='9JSlt'></legend><bdo id='9JSlt'><pre id='9JSlt'><center id='9JSlt'></center></pre></bdo></b><th id='9JSlt'></th></span></q></dt></tr></i><div id='9JSlt'><tfoot id='9JSlt'></tfoot><dl id='9JSlt'><fieldset id='9JSlt'></fieldset></dl></div>
        <legend id='9JSlt'><style id='9JSlt'><dir id='9JSlt'><q id='9JSlt'></q></dir></style></legend>
        • <bdo id='9JSlt'></bdo><ul id='9JSlt'></ul>

                  <tfoot id='9JSlt'></tfoot>
                  本文介绍了Laravel Socialite Facebook 错误:“POST https://graph.facebook.com/oauth/access_token 导致‘400 错误请求’"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已经使用 Laravel Socialite 为 Facebook 进行了社交登录,并且运行良好.我没有改变任何东西,现在它不起作用.尝试登录时显示此错误:

                  I've made social login using Laravel Socialite for facebook and it was working fine. I haaven't changed anything and now it's not working. It shows this error when trying to login:

                  客户端错误:POST https://graph.facebook.com/oauth/access_token导致400 Bad Request响应:{"error":{"message":"此 IP 无法向该应用程序发出请求.","type":"OAuthException","code":5,"fbtrace_id":"D(已截断...)

                  Client error:POST https://graph.facebook.com/oauth/access_tokenresulted in a400 Bad Requestresponse: {"error":{"message":"This IP can't make requests for that application.","type":"OAuthException","code":5,"fbtrace_id":"D (truncated...)

                  我没有更改 Facebook 应用程序中的设置,也没有更改我的代码.我的代码如下:

                  I haven't changed setting in my facebook app, nor in my code. My code is the following:

                  Route::get('login', ['as' =>'getLogin', 'uses'=>'AuthAuthController@getLogin']);
                  Route::get('handleProviderCallback/{provider}', 'AuthAuthController@handleProviderCallback');

                  public function login($provider = false)
                      {
                       if(!$provider) {
                              $user = Input::all();
                              $auth_user = new AuthenticateUser();
                              $is_logged = $auth_user->findByEmailOrCreate($user, false);
                              if($is_logged) {
                  
                                  Session::put('user', Auth::user());
                                  Session::put('user_id', Auth::user()->id);
                                  Session::put('email', Auth::user()->email);
                                  Session::put('name', Auth::user()->name);
                  
                                  return redirect()->intended('dashboard');
                              }
                              return redirect('/')->withInput()->with('error', 'Wrong username or password!');
                          }
                          return Socialite::with('facebook')->redirect();
                      }
                      
                      public function handleProviderCallback($provider=false) {
                          if(Input::has('code')) {
                              $user = Socialite::with($provider)->user();
                              $auth_user = new AuthenticateUser();
                              $provider_user = $auth_user->findByEmailOrCreate($user, $provider);
                              Session::put("user", array($provider_user));
                              Session::put('user_id', $provider_user->id);
                              Session::put('email',$provider_user->email);
                              Session::put('name',$provider_user->name);
                  
                              return redirect('dashboard');
                          }
                      }

                  问题出现在这一行的 handleProviderCallback 方法中:

                  Problem appears in handleProviderCallback method in this line:

                  $user = Socialite::with($provider)->user();.

                  当我只转储这个时:$user = Socialite::with($provider)

                  它显示数据,但是当它像这样用来获取用户数据时,它返回错误:

                  it shows data but when it is used like that to get user data it returns the error:

                  $user = Socialite::with($provider)->user();

                  config/services.php 中,我设置了如下示例:

                  In config/services.php I've set settings like this example:

                    'facebook' => [
                          'client_id' => 'my-client-id-from-fb-app', 
                          'client_secret' => 'my-secret-code-from-fb-app', 
                          'redirect' => 'http://my-example-domain/my-site/handleProviderCallback/facebook'
                      ],

                  在我的 facebook 应用程序中,我在设置中进行了设置:

                  In my facebook app I've set in settings:

                  应用域:my-example-domain,隐私政策网址:http://my-example-domain/my-site/,网站网址:http://my-example-domain/my-site/handleProviderCallback/facebook,有效的 OAuth 重定向 URI:http://my-example-domain/my-site/handleProviderCallback/facebook

                  推荐答案

                  是的,我根本没有检查请求以查看返回的内容,但是 Larachat 上有人帮我解决了这个问题.

                  Yeah, I didn't check the request at all to see what's returned but someone on Larachat helped me solve this problem.

                  在获取用户并处理请求之前,我所要做的就是在回调方法中添加以下代码:

                  All I had to do before getting the user and handle the request was to add the following code in the callback method:

                  if (!$request->has('code') || $request->has('denied')) {
                     return redirect('/');}
                  

                  这篇关于Laravel Socialite Facebook 错误:“POST https://graph.facebook.com/oauth/access_token 导致‘400 错误请求’"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    <tbody id='EUj9I'></tbody>

                  <small id='EUj9I'></small><noframes id='EUj9I'>

                  • <bdo id='EUj9I'></bdo><ul id='EUj9I'></ul>
                      1. <tfoot id='EUj9I'></tfoot>
                          <legend id='EUj9I'><style id='EUj9I'><dir id='EUj9I'><q id='EUj9I'></q></dir></style></legend>

                            <i id='EUj9I'><tr id='EUj9I'><dt id='EUj9I'><q id='EUj9I'><span id='EUj9I'><b id='EUj9I'><form id='EUj9I'><ins id='EUj9I'></ins><ul id='EUj9I'></ul><sub id='EUj9I'></sub></form><legend id='EUj9I'></legend><bdo id='EUj9I'><pre id='EUj9I'><center id='EUj9I'></center></pre></bdo></b><th id='EUj9I'></th></span></q></dt></tr></i><div id='EUj9I'><tfoot id='EUj9I'></tfoot><dl id='EUj9I'><fieldset id='EUj9I'></fieldset></dl></div>