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; }
- 以前写的时候都没有遇到过这种问题, 这次遇到后找了半天也没有发现问题出在哪里, 请大哥们指教下
推荐文章: