• Модуль: socialservices
  • Путь к файлу: ~/bitrix/modules/socialservices/classes/general/google.php
  • Класс: CSocServGoogleOAuth
  • Вызов: CSocServGoogleOAuth::getUrl
public function getUrl($location = 'opener', $addScope = null, $arParams = array())
{
	$this->entityOAuth = $this->getEntityOAuth();

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

	if($addScope !== null)
	{
		$this->entityOAuth->addScope($addScope);
	}
	if(IsModuleInstalled('bitrix24') && defined('BX24_HOST_NAME'))
	{
		$redirect_uri = static::getControllerUrl()."/redirect.php";
		$state = $this->getEntityOAuth()->getRedirectUri()."?check_key=".CSocServAuthManager::getUniqueKey()."&state=";
		$backurl = $GLOBALS["APPLICATION"]->GetCurPageParam('', array("logout", "auth_service_error", "auth_service_id", "backurl"));
		$state .= urlencode('provider='.static::ID.
			"&state=".urlencode("backurl=".urlencode($backurl)
				.'&mode='.$location.(isset($arParams['BACKURL'])
					? '&redirect_url='.urlencode($arParams['BACKURL'])
					: '')
		));
	}
	else
	{
		$state = 'provider='.static::ID.'&site_id='.SITE_ID.'&backurl='.urlencode($GLOBALS["APPLICATION"]->GetCurPageParam('check_key='.CSocServAuthManager::getUniqueKey(), array("logout", "auth_service_error", "auth_service_id", "backurl"))).'&mode='.$location.(isset($arParams['BACKURL']) ? '&redirect_url='.urlencode($arParams['BACKURL']) : '');
		$redirect_uri = $this->getEntityOAuth()->getRedirectUri();
	}

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