EC2上的Laravel Passport 500内部服务器错误 [英] Laravel passport 500 internal server error on EC2

查看:208
本文介绍了EC2上的Laravel Passport 500内部服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Angular 2(不称为4)作为前端以及Laravel 5.4作为API后端来构建应用程序.我正在使用Laravel的护照密码授予功能来验证用户对API的访问.

I'm building an app using Angular 2 (no known as 4) as frontend and Laravel 5.4 as API backend. I'm using Laravel's passport password grant feature to authenticate user access to API.

前端不直接访问oauth路由.我的自定义身份验证控制器正在与oauth/token进行对话,以获取授权值.

The Frontend is not directly accessing oauth routes. My custom auth controller is talking to oauth/token to get the grant values.

我认为它可能与GuzzleHttp \ Client有关,但事实并非如此.即使我尝试直接从Postman访问oauth/token,它仍然会引发500个内部服务器错误.

I thought it could be related to GuzzleHttp\Client, but it was not. Even if I try to access oauth/token directly from Postman, it still throws 500 internal server error.

private function getPasswordGrant($username, $rawPassword) {
    $http = new HttpClient();
    $url = url('/') . "/oauth/token";
    return $http->post($url, [
        "form_params" => [
            "grant_type"    => "password",
            "client_id"     => config("auth.oauth_password_grant_client_id"),
            "client_secret" => config("auth.oauth_password_grant_client_secret_key"),
            "username"      => $username,
            "password"      => $rawPassword,
            "scope"         => "*",
        ],
    ]);
}

这是我的自定义身份验证控制器中的功能,该功能在用另一种方法(登录和注册)对用户进行身份验证后,请求授予密码.

This is the function in my custom Auth Controller which requests for password grant after the user being authenticated in another method (login and signup).

最令人惊讶的是,laravel或apache日志中都没有记录任何东西.

Most amazing thing is there's nothing logged in either laravel or apache logs.

推荐答案

好吧,经过大量的努力和调试.原来是apache无法写入storage/logs/laravel.log并导致此问题.在为存储/文件夹赋予适当的权限后,一切都会按预期工作.

Alright, after a lot of struggle and debugging. It turned out to be apache was unable to write into storage/logs/laravel.log and causing this problem. After giving appropriate permissions to storage/ folder everything is working as expected.

这篇关于EC2上的Laravel Passport 500内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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