laravel 6.* 中使用 passport 报 Could not resolve host
环境:
vagrant搭建的虚拟机,lnmp+laravel 6.*vagrant的配置如下:

问题描述: 在使用
passport获取token的时候报Could not resolve host: blog.test, 如下所示:

问题中的
blog.test是我在本地的hosts文件中配置的获取
token的代码如下:protected function getToken($username, $password) { $response = $this->http->request( "post", "http://blog.test/oauth/token", [ "form_params" => [ "grant_type" => config('passport.grant_type'), "username" => $username, "password" => $password, "client_id" => config('passport.client_id'), "client_secret" => config('passport.client_secret'), "scope" => "*" ] ]); $token = json_decode((string)$response->getBody(), true); return $token; }
- 以前写的时候都没有遇到过这种问题, 这次遇到后找了半天也没有发现问题出在哪里, 请大哥们指教下

关于 LearnKu
推荐文章: