當使用這樣的URL(客戶端憑證交付式)的訪問令牌問:獲取刷新令牌FOSOAuthServerBundle
http://api.local/app_dev.php/oauth/v2/token?client_id=<client_id>&client_secret=<secret>&grant_type=client_credentials
我得到以下JSON響應:
{
access_token: "XXXXXXXXXXX",
expires_in: 3600,
token_type: "bearer",
scope: "user"
}
刷新令牌缺失,任何想法爲什麼這可能是?
我FOSOAuthServerBundle在config.yml:
fos_oauth_server:
db_driver: orm
client_class: Acme\ApiBundle\Entity\Client
access_token_class: Acme\ApiBundle\Entity\AccessToken
refresh_token_class: Acme\ApiBundle\Entity\RefreshToken
auth_code_class: Acme\ApiBundle\Entity\AuthCode
service:
user_provider: platform.user.provider
options:
supported_scopes: user
UPDATE
的客戶實體使得父實體的構造函數的調用(位於FOSOAuthServerBundle):
namespace Acme\ApiBundle\Entity;
use FOS\OAuthServerBundle\Entity\Client as BaseClient;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class Client extends BaseClient
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
public function __construct()
{
parent::__construct();
}
}
我已經更新了有關客戶實體的信息。 – rfc1484 2015-02-10 15:26:29
我的意思是在數據庫中,檢查你的客戶端表,你正在使用的ID,列allowed_grant_types(一個序列化數組),包含refresh_token? – 2015-02-10 15:44:07
它存在於序列化數組中,但它的值爲空。 – rfc1484 2015-02-10 16:13:56