diff --git a/cura/API/Account.py b/cura/API/Account.py index 2651037e9e..2d3023d072 100644 --- a/cura/API/Account.py +++ b/cura/API/Account.py @@ -275,7 +275,11 @@ class Account(QObject): @pyqtProperty(str, notify=accessTokenChanged) def accessToken(self) -> Optional[str]: - return self._authorization_service.getAccessToken() + try: + return self._authorization_service.getAccessToken() + except Exception as e: + Logger.error("Failed to get access token: %s", str(e)) + return None @pyqtProperty("QVariantMap", notify = userProfileChanged) def userProfile(self) -> Dict[str, Optional[str]]: diff --git a/cura/UltimakerCloud/UltimakerCloudScope.py b/cura/UltimakerCloud/UltimakerCloudScope.py index a173c5c758..c30e1f7360 100644 --- a/cura/UltimakerCloud/UltimakerCloudScope.py +++ b/cura/UltimakerCloud/UltimakerCloudScope.py @@ -21,7 +21,7 @@ class UltimakerCloudScope(DefaultUserAgentScope): def __init__(self, application: "CuraApplication"): super().__init__(application) api = application.getCuraAPI() - self._account = api.account # type: Account + self._account: Account = api.account def requestHook(self, request: QNetworkRequest): super().requestHook(request)