![](/img/trans.png)
[英]Get Empty Refresh Token on Production Environment - GMAIL OAuth2 API
[英]Get a new token with the refresh token symfony oauth2
我与FriendsOfSymfony / FOSRestBundle , FriendsOfSymfony / FOSUserBundle和FriendsOfSymfony / FOSOAuthServerBundle一起从事 symfony项目。
在安全性部分,我无法使用刷新令牌来获取新的访问令牌。 我只能获取访问令牌。我已经按照一些教程进行操作,尝试获取新令牌时出现此错误:
{
"error": "unauthorized_client",
"error_description": "Le type de subvention est non autorisee pour cette client_id"
}
网址为: http://myproject.local/oauth/v2/token
这些参数是:
我错过任何配置了吗? 还是我使用了错误的网址或错误的参数? 有什么帮助吗?
该错误表示不允许您的客户端使用refresh_token
授予类型。 您要做的就是将此授予类型添加到您的客户端(未经测试的代码):
$clientManager = $this->container->get('fos_oauth_server.client_manager.default'); // Get the Client manager
$client = $clientManager->findClientByPublicId('PUBLIC ID OF YOUR CLIENT HERE'); // Get the Client
$grant = $client->getAllowedGrantTypes(); // Get the grant types
$grant[] = 'refresh_token'; // Add the refresh_token grant type
$client->setAllowedGrantTypes($grant); // Modify your Client
$clientManager->updateClient($client); // Save your Client
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.