One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
whats
2 years agoExplorer | Level 4
Xcode swiftydropbox setup
Hey, Has anyone been able to set up Swiftydropbox without any user prompt ? I dont know the order or what needs to be called. I don't want the user to have to set up any login. Any quick breakdow...
Здравко
2 years agoLegendary | Level 20
whats wrote:...
-When you say "replace" the refreshing process, what do you mean exactly?
...
😁 Yeah... Maybe I said it too.. "hard". That's why I clarified: "adding app secret". "replace" here means edit the algorithm, no so much actual replace. This results from, as I already said, application secret is NOT supported in Dropbox Swift SDK (don't ask me why). It's supported by API itself (as you probably already know) and most of the other Dropbox SDKs.
whats wrote:...
-Where would I use the app secret? Would this only be in the beta 10.0.1?
...
No, it's not related to any particular version, but rather all of them (or that what you're using).
whats wrote:...
-Do I use the DropboxTransportClient?
...
Hm..🤔 To be honest, I'm not sure what you mean here. You will always use that class, but you don't need to do it explicitly. It's just a internal class. If needed, clarify what you mean.
whats wrote:...
-Is the initial call, dropbox = DropboxClient(key,secret,refreshtoken)? Then use dropbox to call api?...
🙂 As far as I know there is no such an init call (might be convenient for many users, but...). The refresh token itself is part of the DropboxAccessToken that you need to pass (you don't need to handle/pass it in addition). App key is part of the app configuration (doesn't need to pass the refresh token in addition). You can add app secret to the configuration in the same way as done already for the app key and use it further in the updated refreshing (again in the same way as app key is used there - the only change needed there).
whats
2 years agoExplorer | Level 4
Thank you again for the detailed reply! I guess I am lost to which part needs the app secret, I was unable to locate where I could pass it
- Здравко2 years agoLegendary | Level 20
whats, If it's so hard for you to add support for app secret, then perform OAuth flow using PKCE (as I mentioned it as a variant before). In such a way you wouldn't need app secret and can use Dropbox Swift SDK as is (without change). You don't need to implement such a flow in the same language. Throughout the forum and other SDKs are lot of examples you can "hire". For instance take a look here. It's a Python script that you can perform OAuth on (it uses PKCE). Once you authenticate yourself, get the saved refresh token and use it. 😉 In such a case only app key would be needed - something Dropbox Swift SDK supports. That's it.
Hope this helps.
PS: Keep in mind that providing this application to somebody else will let other person access to your account - something potentially dangerous for your data - take care.
- whats2 years agoExplorer | Level 4
I have performed the Oauth and have the refresh key, my implementation currently isnt working. I assume its an authentication issue, is there any way to have the http request errors post to console when testing the app so that I can see what error I am running into?
- Greg-DB2 years ago
Dropbox Staff
whats The SwiftyDropbox SDK doesn't offer a way to print out the raw HTTP request/response, but you should be able to check the `error` for any given call, e.g., as shown in the `response` handler in the examples here.
- whats2 years agoExplorer | Level 4Hey Здравко would this be the right approach? I would then call client.upload for a rough example. I have the manually obtained refreshToken and appKeyclass <CLASSNAME>: TransportClient{private var client:DropboxClientinit(){client=DropboxClient(appKey:"<APPKEY>",refreshToken:"<REFRESHTOKEN>")}}extension DropboxClient{public convenience init(appKey:"<APPKEY>",refreshToken:"<REFRESHTOKEN>"){let transportClient=DropboxTransportClientImpl(transportClient:transportClient:)self.init(transportClient:transportClient)}}extension DropboxTransportClientImpl{public convenience init(appKey:"<APPKEY>",refreshToken:"<REFRESHTOKEN>"){let oauthManager=DropboxOAuthManager(appKey:"<APPKEY>",secureStorageAccess: SecureStorageAccesDefaultImpl.init())var dropboxToken=DropboxAccessToken(accessToken:"",uid:"",refreshToken:"<REFRESHTOKEN>")oauthManager.refreshAccessToken(dropboxToken,scopes:[],queue:nil,completion:{_in})let accessTokenProvider=ShortLivedAccessTokenProvider(token:dropboxToken,tokenRefresher:oauthManager)self.init(accessTokenProvider:accessTokenProvider,selectUser:nil,pathRoot:nil)}}
- Здравко2 years agoLegendary | Level 20
Hm..🤔 Once you have refresh token using PKCE (you didn't mention but I suppose you used PKCE since it's mandatory for skipping app secret), would be easier just to call something like:
import SwiftyDropbox let token = DropboxAccessToken(accessToken: "", uid: "", refreshToken: "<your refresh token here>", tokenExpirationTimestamp: ("0" as TimeInterval)) let client = DropboxClient(accessToken: token, dropboxOauthManager: DropboxOAuthManager.sharedOAuthManager)
... and use the client further on as in all examples. It's simpler. Isn't it? 🧐 The above code is just an illustration. You should have initialized the SDK already before running above code - see again the referred example (where the app key goes)!
PS: While you use PKCE, you don't need to change anything in SDK itself. 😉
- whats2 years agoExplorer | Level 4
Hmmm, I tried to implement these three things and seem to have made it worse. It now crashes as soon as it launches with the Termination Reason: Namespace SIGNAL, Code 4 Illegal instruction:4
- Здравко2 years agoLegendary | Level 20
This means that your (Intel) processor tries access something uninitialized (most probably). Did you initialize your SDK in advance, as I noted? If not, DropboxOAuthManager.sharedOAuthManager points to nowhere! Something that likely be reason for such signal.
Of course might be something else too. You can investigate where this happens. 🙋 Try debug it!
- whats2 years agoExplorer | Level 4
Interesting! Thank you for all the help so far, I was thinking that I perhaps didnt play the initialization in the correct spot. I will investigate this further !
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,949 PostsLatest Activity: 2 hours ago
If 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!