libraries/Maniaplanet/WebServices/ManiaConnect/Client.php
protected function getAccessToken()
	{
		$token = self::$persistance->getVariable('token');
		if(!$this->isAccessTokenExpired($token))
		{
			return $token->access_token;
		}
		else if ($token !== null && $token->refresh_token !== null)
		{
			$token = $this->getTokenFromRefreshToken($token->refresh_token);
			return $token->access_token;
		}

		if(isset($_REQUEST['code']))
		{
			$code = $_REQUEST['code'];
			if($code)
			{
				$redirectURI = self::$persistance->getVariable('redirect_uri') ? : $this->getCurrentURI();

				$token = $this->getTokenFromCode($code, $redirectURI);

				self::$persistance->deleteVariable('redirect_uri');
				self::$persistance->deleteVariable('code');

				return $token->access_token;
			}
		}
	}
protected function getAccessToken()
	{
		$token = self::$persistance->getVariable('token');
		if(!$this->isAccessTokenExpired($token))
		{
			return $token->access_token;
		}
		else if ($token !== null && $token->refresh_token !== null)
		{
			$token = $this->getTokenFromRefreshToken($token->refresh_token);
			return $token->access_token;
		}

		if(isset($_REQUEST['code']))
		{
			$code = $_REQUEST['code'];
			if($code)
			{
				$redirectURI = self::$persistance->getVariable('redirect_uri') ? : $this->getCurrentURI();

				$token = $this->getTokenFromCode($code, $redirectURI);

				self::$persistance->deleteVariable('redirect_uri');
				self::$persistance->deleteVariable('code');

				return $token->access_token;
			}
		}
	}
protected function getAccessToken ( ) { $ token = self :: $ persistance -> getVariable ( 'token' ) ; if ( ! $ this -> isAccessTokenExpired ( $ token ) ) { return $ token -> access_token ; } else if ( $ token !== null && $ token -> refresh_token !== null ) { $ token = $ this -> getTokenFromRefreshToken ( $ token -> refresh_token ) ; return $ token -> access_token ; } if ( isset ( $ _REQUEST [ 'code' ] ) ) { $ code = $ _REQUEST [ 'code' ] ; if ( $ code ) { $ redirectURI = self :: $ persistance -> getVariable ( 'redirect_uri' ) ? : $ this -> getCurrentURI ( ) ; $ token = $ this -> getTokenFromCode ( $ code , $ redirectURI ) ; self :: $ persistance -> deleteVariable ( 'redirect_uri' ) ; self :: $ persistance -> deleteVariable ( 'code' ) ; return $ token -> access_token ; } } }
Tries to get an access token.
If one is found in the session, it returns it.
If a code is found in the request, it tries to exchange it for an access
token on the OAuth2 Token Endpoint
Else it returns false

@return string An OAuth2 access token, or false if none is found
Tries to get an access token . If one is found in the session it returns it . If a code is found in the request it tries to exchange it for an access token on the OAuth2 Token Endpoint Else it returns false