Closed john-work-ios closed 1 year ago
Hello. Other than calling an API method, there is no way for a client to detect that a token has been invalidated. The way I see it, there are two approaches to your problem:
willEnterForeground
) to check the validity of the token. One simple way to do that would be to call the userinfo
method (fetchUserInfo()
on the client instance). This approach does not eliminate the problem, only mitigates it since your token can still be invalidated between the last time you checked its validity and the time the user attempts a file operation.The PCloud.sharedClient
instance only requires authentication data in the keychain. That's intended. It's possible to add a utility method that checks the validity of the token before initializing the shared client. But I'm against doing that since it does very little to help with the problem.
Thank you for this precious information! Much appreciated. I'll see what I can come up with based on that. Best regards
I have been integrating the pCloud Swift SDK successfully. I'm testing for edge cases, when the user revokes access to the app, in his pCloud console. My problem: I still get a PCloud.sharedClient instance on setUp, and I only receive an error when the user tries to upload a file (or list a folder). How can I detect this before? Such that the user is being asked to authenticate before performing the upload/list folder/or any task.
Thanks!