![](/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.