We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
vewert
4 years agoExplorer | Level 4
How to set clientIdentifier, using SwiftyDropbox
In the Java API, a clientIdentifier is set when creating a DbxRequestConfig object. I'm wondering, is there an equivalent in SwiftyDropbox? I was trying to search it myself, but it seem like the link...
- 4 years ago
Yes, those are optional so you can set them to nil, except for "accessToken", but it looks like you can just set that to an empty string, assuming you're using the standard authorization functionality such as authorizeFromControllerV2 and authorizedClient which will take care of that for you.
vewert
Explorer | Level 4
Thanks Greg,
I looked at the sample. How do I create a DropboxTransportClient, if all I want to do is set the userAgent; can I set all the other parameters to nil, to get the default behaviour?
Greg-DB
4 years agoDropbox Staff
Yes, those are optional so you can set them to nil, except for "accessToken", but it looks like you can just set that to an empty string, assuming you're using the standard authorization functionality such as authorizeFromControllerV2 and authorizedClient which will take care of that for you.
- vewert4 years agoExplorer | Level 4
Thanks, that seems to work.
Also, I noticed the link to the documentation now works, so thanks for that as well.
One side question, I was looking through the documentation, but other than the example code, I couldn't find the actual api documentation for DropboxTransportClient (listing its Declaration, Parameters, etc.), I'm not sure if I just can't find it, or if its not there.
- Greg-DB4 years agoDropbox Staff
Yes, we got the docs back up. It looks like the DropboxTransportClient class in particular isn't being included in the documentation though. I'll see if we can get that done.
- vewert9 months agoExplorer | Level 4
Hi, sorry to re-open this discussion, but it seems like this isn't working anymore after upgrading SwiftyDropbox to 10 (10.0.1). It seems like when using a custom DropboxTransportClient, so I can set the user-agent, the access token doesn't get refreshed. After integrating with Dropbox, all my calls work fine, but if I don't use the app for awhile (4-5 hours), and then open the app again, I get a ".tag" = "expired_access_token" error.
If I change my code, and call DropboxClientsManager.setupWithAppKey() without passing a DropboxTransportClient, it seems to work.
I looked at the source code, and it seems there was a change to the code for the DropboxTranportClient
Which may cause this change of behaviour.
My code to create the DropboxTransportClient is as follows:
let transportClient: DropboxTransportClientImpl = DropboxTransportClientImpl( accessToken: "", userAgent: userAgent, selectUser: nil)
- Greg-DB9 months agoDropbox Staff
In order for the SDK to perform the refresh for you, to avoid the "expired_access_token" error, it will need a refresh token.
Can you let me know if you're currently using the standard authorization functionality (authorizeFromControllerV2), or if you're supplying an access token/refresh token yourself?
The standard authorization functionality should handle this automatically for you.
Otherwise, can you show me how you're supplying the access token/refresh token? Please be sure to redact any access token or refresh token string itself though.
Thanks!
- vewert9 months agoExplorer | Level 4
Yes, I am using the standard authorization functionality (authorizeFromControllerV2) as in the sample code.
The difference between my code, and the sample code is in how a call `setupWithAppKey` inside the AppDelegate. In order to set the userAgent, I create an instance of transportClient:
let transportClient: DropboxTransportClientImpl = DropboxTransportClientImpl( accessToken: "", userAgent: userAgent, selectUser: nil)
and then call:
DropboxClientsManager.setupWithAppKey("<APP_KEY>", transportClient: transportClient)
if I don't use the transportClient, and simply call:
DropboxClientsManager.setupWithAppKey("<APP_KEY>")
then the refresh token seems to work, and I don't get the expired token error.
This used to all work before I upgraded to SwiftyDropbox 10 (10.0.1), but now it doesn't, so I suspect there may have been a change in the DropboxTransportClientImpl initializer code.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!