public function getAccessToken()
    {
        /** @var AccessToken $accessToken */
        if ($accessToken = $this->cache->get(static::SESSION_ACCESS_TOKEN_KEY)) {
            if (!$accessToken->hasExpired()) {
                return $accessToken;
            }
        }
        $accessToken = $this->authClient->getAccessToken('client_credentials');
        $ttl = $accessToken->getExpires() - time();
        $this->cache->save(static::SESSION_ACCESS_TOKEN_KEY, $accessToken, $ttl);

        return $accessToken;
    }
public function getAccessToken()
    {
        /** @var AccessToken $accessToken */
        if ($accessToken = $this->cache->get(static::SESSION_ACCESS_TOKEN_KEY)) {
            if (!$accessToken->hasExpired()) {
                return $accessToken;
            }
        }
        $accessToken = $this->authClient->getAccessToken('client_credentials');
        $ttl = $accessToken->getExpires() - time();
        $this->cache->save(static::SESSION_ACCESS_TOKEN_KEY, $accessToken, $ttl);

        return $accessToken;
    }
public function getAccessToken ( ) { /** @var AccessToken $accessToken */ if ( $ accessToken = $ this -> cache -> get ( static :: SESSION_ACCESS_TOKEN_KEY ) ) { if ( ! $ accessToken -> hasExpired ( ) ) { return $ accessToken ; } } $ accessToken = $ this -> authClient -> getAccessToken ( 'client_credentials' ) ; $ ttl = $ accessToken -> getExpires ( ) - time ( ) ; $ this -> cache -> save ( static :: SESSION_ACCESS_TOKEN_KEY , $ accessToken , $ ttl ) ; return $ accessToken ; }
Get AccessToken from AS or session

@return \League\OAuth2\Client\Token\AccessToken
Get AccessToken from AS or session