我已经在 Laravel https://sso/{custom_path}/token 中使用 Api 进行单点登录选项,就像使用 jwt 创建的 Api 一样。\n最后在 Web 应用程序中将标头中的访问令牌和内容类型传递给 Api 调用使用http客户端guzzle。\n使用内容类型application/x-www-form-urlencoded,并在form_params中使用参数。\n但作为响应,我缺少grant_type。当我在 form_parms 数组中传递 grant_type 时。有没有其他方法可以解决这个问题。任何有价值的回应都会被考虑。
\n代码:
\n$uri = $this->userTokenAuthencticateUrl();\n $token = session('token')->access_token;\n $params['header'] = [\n "Content-Type: application/x-www-form-urlencoded",\n "Authorization: Bearer $token"\n ];\n $params['form_params'] = array(\n 'grant_type' => 'xxxxx',\n 'response_include_resource_name' => 'xxx',\n 'audience' => 'xxxx', \n 'permission' => 'xxxxxx',\n );\n $response = Http::post($uri, $params);\n dd($response->json());\nRun Code Online (Sandbox Code Playgroud)\n回应:
\narray:2 [\xe2\x96\xbc\n "error" => "invalid_request"\n "error_description" => "Missing form parameter: grant_type"\n]\nRun Code Online (Sandbox Code Playgroud)\n