cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

Re: Getting refreshed access token from Generated access tokem

Getting refreshed access token from Generated access tokem

SneYellow46
Explorer | Level 4

Hi,

I have an iOS objective c application connected with dropbox SDK.

 

We are using generated access token to access apps folder from my BD account.

 

 

 

client = [[DBUserClient alloc] initWithAccessToken:@"sl.BThRWss....."];

 

 

 

But this Generated access token expires after sometime. What is the possible solution so that it doesnt expire or get a refreshed access token.

Note that we need to use the generated access token approach other than oAuth flow. 

Can you provide any code sample in Objective c to get this refreshed token or how we can achieve this?

 

Thanks,

14 Replies 14

SneYellow46
Explorer | Level 4

How I will get the refresh token from generated token? Or you are suggesting some other approach?

is there any sample available for objective-c dropbox SDK?

 

I know that using oAuth flow tokens are refreshed automatically by DB SDK. But in my case what is the solution?

 

Thanks,

Здравко
Legendary | Level 20

@SneYellow46 wrote:

...

I know that using oAuth flow tokens are refreshed automatically by DB SDK. But in my case what is the solution?

...


The same. 😉 Once you get to the authentication info just save it and embedding. That's it. Take a look on the description if you have something forgotten.

SneYellow46
Explorer | Level 4

Hi @Здравко ,

 

Is there a way I can make Generated token with "No expiration"?

Like how it was earlier.

ViewAccessToken.png

SneYellow46
Explorer | Level 4

Hi @Здравко ,

i get refreshed token using this , and i believe refresh tokens doest expire.

How I can make the DBUserClient, initWithAccessToken call with this refresh token to get access to my dropbox.

similar to , 

 client = [[DBUserClient alloc] initWithAccessToken:@"I5wqb1d...."];

Can you provide any code sample in objective c to do this? I found with methods with initWithAccessToken which takes in refresh token param but didn't understand much of it.

Здравко
Legendary | Level 20

@SneYellow46 wrote:

...

How I can make the DBUserClient, initWithAccessToken call with this refresh token to get access to my dropbox.

similar to ,

 client = [[DBUserClient alloc] initWithAccessToken:@"I5wqb1d...."];

... I found with methods with initWithAccessToken which takes in refresh token ...

No unfortunately, the method 'initWithAccessToken' (any of them) doesn't provide so simple way (don't ask me why; if I have to bet, it's cause Obj-C supposes to be used for client side apps - i.e. with OAuth flow). The method mentioned doesn't receive refresh token directly as a string, but does accept token provider object which on its own can be initialized with 'DBAccessToken' object (don't ask me why this class names so). The last object can represent variety authentication info (non restricted to simple access token).

So first you can create 'DBAccessToken' object using appropriate constructor. Next a client object initialization can be done as performed here. Warning: Select proper transport config, matching to the way that you have used for the refresh token (it's good idea to get a refresh token using PKCE instead)! Mistake for the methods in use will make refresh fails.

Good luck.

Need more support?