• Модуль: socialservices
  • Путь к файлу: ~/bitrix/modules/socialservices/classes/general/googleproxy.php
  • Класс: CSocServGoogleProxyOAuth
  • Вызов: CSocServGoogleProxyOAuth::getUrl
public function getUrl($location = 'opener', $addScope = null, $arParams = array())
{
	if(IsModuleInstalled('bitrix24') && defined('BX24_HOST_NAME'))
	{
		return '';
	}

	$this->entityOAuth = $this->getEntityOAuth();

	if($this->userId === null)
	{
		$this->entityOAuth->setRefreshToken("skip");
	}

	if($addScope !== null)
	{
		$this->entityOAuth->addScope($addScope);
	}

	$state = 'provider='.static::ID
		. '&site_id=' . SITE_ID
		. '&backurl=' . urlencode(
			$GLOBALS["APPLICATION"]
				->GetCurPageParam(
					'check_key=' . CSocServAuthManager::getUniqueKey(),
					["logout", "auth_service_error", "auth_service_id", "backurl"]
				)
		)
		. '&mode=' . $location
			. (isset($arParams['BACKURL'])
				? '&redirect_url=' . urlencode($arParams['BACKURL'])
				: '')
		. '&user_token=' . urlencode($this->generateUserToken())
		. '&hostUrl=' . urlencode(BitrixMainEngineUrlManager::getInstance()->getHostUrl())
	;

	$redirect_uri = $this->getEntityOAuth()->getRedirectUri();

	return $this->entityOAuth->GetAuthUrl($redirect_uri, $state, $arParams['APIKEY']);
}