在buffer
中添加Passport::enableImplicitGrant();
后,使用路线进行测试
AuthServiceProvider.php
结果会附加在https://consumer.dev/callback/这样的网址
中如何将访问令牌返回到未附加在URL中的json,或者如何在laravel passport中正确使用隐式授权并将令牌返回到json格式。?
答案 0 :(得分:0)
你的意思是
return response()->json('http://passport.dev/oauth/authorize?'.$query);
答案 1 :(得分:0)
通过使用Passport::enableImplicitGrant()
并包括response_type => 'token'
,您将明确告诉oAuth使用ImplicitGrant流,根据OAuth规范,该流将在片段化的url中返回access_token
(在#部分之后)。如果您希望使用JSON响应,则这是正确的行为,您可以考虑使用其他oAuth grant_types。
请参阅下面的链接以获取有关隐式授权流程的进一步说明