【发布时间】:2022-12-14 09:48:11
【问题描述】:
我正在尝试从 url oauth/token 获取令牌详细信息(包括刷新令牌和过期时间),但不幸的是我无法通过直接调用该函数的 Postman 获取它。但是如果我直接调用 URL 那么它将完美地工作。
下面提供了我的代码详细信息
1.控制器登录功能
$response = Http::asForm()->post('http://127.0.0.1:9394/oauth/token', [
'grant_type' => 'password',
'client_id' => '3',
'client_secret' => 'V7GUakzjRViTnIP6zryDymYv5tD0dpLxGvhm0gUq',
'username' => $request->email,
'password' => $request->password,
'scope' => '',
]);
2.Postman调用登录功能enter image description here
3.邮递员直接调用urlenter image description here
我的目标是在人们登录的同时获取令牌详细信息,因为 Passport 仅显示使用创建令牌生成令牌的函数。
【问题讨论】:
-
对于刷新令牌,需要发送文档中给出的令牌laravel.com/docs/9.x/passport#refreshing-tokens
-
@ABHILASHAK.M 您提供的方法在 Postman 中有效(直接调用 oauth/token URL),但我尝试使用 Postman 在 Laravel 中调用此函数仍然出现与密码 grand_type 相同的错误。你有什么想法吗?
标签: laravel postman laravel-passport