cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We are making some updates so the Community might be down for a few hours on Monday the 11th of November. Apologies for the inconvenience and thank you for your patience. You can find out more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Xcode swiftydropbox setup

Xcode swiftydropbox setup

whats
Explorer | Level 4

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 breakdowns on the process for me to use a refresh key and app key in order to get the access token without a user prompt would be amazing

 

Thank you !

18 Replies 18

Greg-DB
Dropbox Staff

It's not possible to skip the app authorization flow and gain access to the end-user's account. In order for the app to access the user's account, the user needs to grant the app access to their account. This only needs to be done manually once per app-account pair.

whats
Explorer | Level 4

I dont want to gain access to their account, I want to use my account refresh token and app key. Is this possible ?

Greg-DB
Dropbox Staff

The API was designed with the intention that each user would link their own Dropbox account, in order to interact with their own files. While it is technically possible to always connect to just one account for all users, we do not officially support this, for various technical and security reasons.

whats
Explorer | Level 4

Absolutely understandable, would you be able to direct me on this flow?

Здравко
Legendary | Level 20

@whats, you can take a look here how you can perform OAuth by hands and use the refresh token in your code (you'll need app secret too by the way).

whats
Explorer | Level 4

Hey thank you so much! What does your code look like in xcode once you have these parameters? What are you calling?

Здравко
Legendary | Level 20

@whats wrote:

... What does your code look like in xcode once you have these parameters? What are you calling?


The code anywhere looks exactly like you would code it, nothing else. There is no a single way to do it - it's matter of design decision. If you want to stick as much as possible to the Dropbox Swift SDK, you should use PKCE version of what I posted (i.e. not exactly the same) - Dropbox Swift SDK doesn't support app secret. In such a case (PKCE usage) you need to implement DropboxAccessToken object yourself and pass it further on client object initialization.

To avoid PKCE you need to re-implement (replace) refreshing process (adding app secret there).

Good luck.

whats
Explorer | Level 4

Hey @Здравко ! I tried building this today and had a few questions if you're know the answers,

-When you say "replace" the refreshing process, what do you mean exactly? 
-Where would I use the app secret? Would this only be in the beta 10.0.1?
-Do I use the DropboxTransportClient?
-Is the initial call, dropbox = DropboxClient(key,secret,refreshtoken)? Then use dropbox to call api?

Thank you for all the help !

 

 

Здравко
Legendary | 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).

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    whats Explorer | Level 4
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?