我使用Laravel 7和护照,但出现了一些错误
这是我的控制器
class LoginController extends Controller
{
public function login(Request $request){
$response = Http::post('http://localhost/vue-spa/public/oauth/token',[
'grant_type' => 'password',
'client_id' => 2,
'client_secret'=> 'Z7YFRiUQITRGkWAgCuI8rNyss7BVQJDQXMZrRWiR',
'username' => $request->email,
'password'=> $request ->password,
'scope' => ''
]);
if($response->clientError()){
return $response->json('Email atau Password Salah', 400);
}
elseif($response->serverError()){
return $response->json('Server Error', 500);
}
return $response->body();
}
}
并且我收到这样的错误
我必须解决这个问题
只需替换
'grant_type'=>'密码'
to
'grant_type'=>'client_credentials'
我必须解决这个问题
只需替换
'grant_type'=>'密码'
to
'grant_type'=>'client_credentials'