어떻게 토큰을 새로 고칠 수 있습니까? Google api를이 토큰과 함께 사용합니다. 작동하지만이를 새로 고치는 방법을 찾을 수 없습니다.이 예에서는 만료 된 시간을 저장하지 않습니다. 나는 토큰이 내가 일할 수 유효하지만 경우에 만료되는 경우oauth2 토큰을 새로 고침 Google api 및 HWIOAuthBundle
`access_type: offline `
다음
$client = new Google_Client();
//$client->setClientId($GoogleClientId);
$client->setApplicationName($GoogleAppName);
$client->setClientId($this->user->getGoogleId());
$client->setAccessType('offline');
내가이 예에서 우리는 '돈 때문에
$token = [
'access_token' => $this->user->getGoogleAccessToken(),
'expires_in' => (new \DateTime())->modify('-1 year')->getTimestamp(),
];
내가이 모든 날짜를 넣어 시도 필요 t 만료 시간을 절약하십시오
https://gist.github.com/danvbe/4476697
여기 6,$client->setAccessToken($token);
if($client->isAccessTokenExpired()){
$refreshedToken = $client->refreshToken($client->getAccessToken());
난이 오류
array:2 [▼
"error" => "invalid_request"
"error_description" => "Could not determine client ID from request."
]
토큰 새로 고침 HwiAuthBundle 방법이있다? Google_Client를 새로 고치면 왜 작동하지 않습니까?
되지 않습니다 : 난 당신이 OAuth 클라이언트 ID를 생성하는 것이 필요하다고 생각? 고객 ID는 사용중인 새로 고침 토큰을 만드는 데 사용 된 Google 개발자 콘솔의 클라이언트 ID입니다. – DaImTo
아직이 스레드를 보지 못했다면 토큰을 새로 고치면 해당 번들의 우선 순위가 낮아집니다. https://github.com/hwi/HWIOAuthBundle/issues/457 따라서 전체 플러그 앤 플레이 솔루션, 이것은 아니다. –