我一直在尝试access_token为我的 api创建一个。我遵循了设置并使用 Postman 来测试/创建令牌。我似乎无法克服invalid_grant错误。
我已经尝试了我能找到的所有组合,但没有任何运气。这是我的设置:
发送POST请求至:http://mywebsite.local/oauth/token
在正文中,我设置form-data为这个(名称/值):
grant_type password
client_id 1
client_secret <super_long_string>
username my@email.com
password secret
Run Code Online (Sandbox Code Playgroud)
我使用 tinker 创建了一个虚拟用户:
factory('App\User')->create()
Run Code Online (Sandbox Code Playgroud)
我在上面使用新创建的用户作为我的用户名/密码。
不管我在做什么(没有传递任何东西),这是我总是看到的错误:
{
"error": "invalid_grant",
"error_description": "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.",
"hint": "",
"message": "The provided authorization grant (e.g., …Run Code Online (Sandbox Code Playgroud)