public function getAccessToken()
    {
        // check in the session
        $existing = $this->storage->getKey('authentication');

        // is it still valid
        if ($existing && $existing->expires > time()) {
            return $existing->access_token;
        }

        // make the call to the API
        $authResponse = $this->makeAuthenticationCall();

        // save the access token result
        $this->storage->setKey('authentication', $authResponse->getRaw());

        // return the token
        return $authResponse->getRaw()->access_token;
    }
public function getAccessToken()
    {
        // check in the session
        $existing = $this->storage->getKey('authentication');

        // is it still valid
        if ($existing && $existing->expires > time()) {
            return $existing->access_token;
        }

        // make the call to the API
        $authResponse = $this->makeAuthenticationCall();

        // save the access token result
        $this->storage->setKey('authentication', $authResponse->getRaw());

        // return the token
        return $authResponse->getRaw()->access_token;
    }
public function getAccessToken ( ) { // check in the session $ existing = $ this -> storage -> getKey ( 'authentication' ) ; // is it still valid if ( $ existing && $ existing -> expires > time ( ) ) { return $ existing -> access_token ; } // make the call to the API $ authResponse = $ this -> makeAuthenticationCall ( ) ; // save the access token result $ this -> storage -> setKey ( 'authentication' , $ authResponse -> getRaw ( ) ) ; // return the token return $ authResponse -> getRaw ( ) -> access_token ; }
Get an access token from the local storage if available, otherwise request one from the API

@return string the access token
@throws Exceptions\AuthenticationException
Get an access token from the local storage if available otherwise request one from the API