Q On Android and iOS Clients

Hi,

I’ve been working with tus for about a month now using the nodjs server and Android and iOS SDKs. Its going very well, uploads are fast and dependable.

I’m adding authentication on the server side using the onUploadCreate hook. If the user isn’t authenticated we throw a 403 and set status_code and body for the client in the express response object.

The problem is, my client team doesn’t know how to check for the 403 and examine the status_code to determine the server application error.

Can you provide some guidance on which class to override in the SDKs so the client can process status_code and body when an http 403 is received?

Thanks,
Roy

For our Android and iOS clients, this is not as easily possible yet as we would like. tus-js-client has good support for retrieving responses, but our other clients not yet. For the Android client, you could look into Response server as JSON · Issue #89 · tus/tus-java-client · GitHub. For the iOS client, I will forward this question to our iOS developer.

In TUSKit versions 3.1.6 and earlier this is unfortunately not possible. I have just published TUSKit 3.1.7 which will allow developers to catch and inspect the status code for requests that received a non 200 OK HTTP status code.

See the CHANGELOG for information on how to do this: TUSKit/CHANGELOG.md at main · tus/TUSKit · GitHub

Inspecting the body will not be possible due to our in-progress migration to background URLSessions which do not receive and HTTP response body for upload tasks.

That’s good to know! Then we will try to avoid adding features to tusd where a response body might be need. Thanks!