src/ApiBase.php
public function getAccessToken(): ApiAccessToken
    {
        try {
            $accessToken = $this->tokenStorage->getAccessToken();
        } catch (UnableToAcquireAccessToken $e) {
            $accessToken = null;
        }

        if ($accessToken && $accessToken->isExpired()) {
            $this->tokenStorage->unsetAccessToken();
            $accessToken = null;
        }

        return $accessToken ?: $this->refreshToken();
    }
public function getAccessToken(): ApiAccessToken
    {
        try {
            $accessToken = $this->tokenStorage->getAccessToken();
        } catch (UnableToAcquireAccessToken $e) {
            $accessToken = null;
        }

        if ($accessToken && $accessToken->isExpired()) {
            $this->tokenStorage->unsetAccessToken();
            $accessToken = null;
        }

        return $accessToken ?: $this->refreshToken();
    }
Get the API access token. This method can be used to verify if provided `ApiSettings` are valid.

@return ApiAccessToken
@throws RefreshTokenFailed