1<?php 2 3namespace dokuwiki\plugin\oauthgoogle; 4 5/** 6 * Modify the default lusitania Google Service 7 */ 8class Google extends \OAuth\OAuth2\Service\Google { 9 10 /** 11 * To make sure we get a refresh token, we need consent for an offline 12 * application. Thuse we always ask for consent again on login. 13 * 14 * @link https://stackoverflow.com/a/10857806/172068 15 * @inheritdoc 16 */ 17 public function getAuthorizationEndpoint() 18 { 19 // offline mode provides a refresh token 20 $this->setAccessType('offline'); 21 22 // always show consent screen again 23 $uri = parent::getAuthorizationEndpoint(); 24 $uri->addToQuery('prompt', 'consent'); 25 return $uri; 26 } 27 28} 29