Laravel Socialite 3.0 Google Return 403-禁止 [英] Laravel socialite 3.0 google return 403 - Forbidden

查看:181
本文介绍了Laravel Socialite 3.0 Google Return 403-禁止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Laravel 5.6和socialite 3.0.我已经从开发人员控制台创建了Google API,并启用了Gmail API和Google Plus.请检查屏幕截图.

I am using Laravel 5.6 and socialite 3.0. I have created google API from developer console and enable for Gmail API and google plus. please check screen shot.

此外,我必须在.env文件中进行设置.

Also, I have to make setup inside .env file.

Google回调返回403错误代码

Google callback return 403 error code

我已经创建了类和方法

public function redirect($provieder)
{
     return Socialite::driver($provieder)->redirect();
}

public function callback($provieder)
{           
    try{
        $user = Socialite::driver($provieder)->stateless()->user();
        if (isset($user)) {
            $social = $this->createUser($user,$provieder);
            return redirect()->route('profile.fill','location');
        }
        return redirect()->route('user.signup');
    }catch (Exception $e) {
        return redirect('auth/google');
    }
 }

我已经创建了路由文件

Route::get('auth/{provider}', 'OAuth\SocialController@redirect');
Route::get('auth/{provider}/callback', 'OAuth\SocialController@callback');

推荐答案

此错误表明服务器可以理解来自客户端的请求,但是它拒绝继续对该请求执行进一步的操作.当服务器被配置为出于某种原因拒绝客户的请求时,通常会显示该信息.

This error says that the server could understand the request from the client, but it refuses to proceed with further actions with the request. It is often displayed when the server is configured to deny the client’s request for some reason.

403错误页面背后的原因

如果您输入的网址正确,则可能是以下三个原因之一.

If the URL you’ve entered is correct, then it can be any of the following three reasons.

1)没有索引页

2)空的html目录

2) Empty html directory

3)权限配置不当或所有权问题.

上面列出的是403禁止错误的最常见原因.

The above listed are the most common reasons of 403 forbidden error.

检查链接以了解如何修复它

这篇关于Laravel Socialite 3.0 Google Return 403-禁止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆