We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
phunction
4 years agoHelpful | Level 5
Gettng a refresh token from GetAuthorizeUri
Hi, I am trying to convert my .net code (used for the old non expiring tokens) to get a refresh token. In this part: var authorizeUri = DropboxOAuth2Helper.GetAuthorizeUri(OAuthResponseType.Token, ...
- 4 years ago
phunction wrote:... Is there a way they can just authorize my app so I don't have to deal with the login part? ...
phunction take a look on the line where refresh token is referred to. Once you got to this token, next time you can skip actual login part and process directly the client creation. Owning the token keeps you (your application actually) logged in corresponding account, where you have logged in already before. 😉
Greg-DB may be a good idea new feature providing serialization/deserialization of current client tokens status. This would provide an easier way for managing most recent state (keep/restore). Is .NET SDK the only kit that missing this feature? 🤔
Здравко
4 years agoLegendary | Level 20
Hi phunction,
Good reference point could be one of the examples. On the enlightened line take a look at "tokenAccessType: TokenAccessType.Offline". 😉
Hope this helps.
phunction
4 years agoHelpful | Level 5
Thanks, I am trying to use this in Xamarin.iOS using a webview. I am unable to find any examples of this when it comes to getting a refresh token (offline access type), it works fine the older way but that of course only gives the very temporary token.
Any hints would be appreciated.
I guess my main goal is how do I present a login screen in my app so the user can login to dropbox and I can then use that to get the refresh token. Is there a way they can just authorize my app so I don't have to deal with the login part? Since they already logged into the actual drop box app.
- Greg-DB4 years ago
Dropbox Community Moderator
phunction As Здравко indicated, setting tokenAccessType: TokenAccessType.Offline on GetAuthorizeUri is the right way to request offline access in order to get a refresh token, as shown in the example they linked to. You can find the full options for GetAuthorizeUri in the documentation.
Also, please note that unfortunately the Dropbox .NET SDK isn't officially supported for Xamarin, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.
In any case, the OAuth app authorization flow should be processed in the user's system browser, not a web view. See here for more information: https://www.dropbox.com/developers/documentation/http/documentation#oauth2-authorize
- Здравко4 years agoLegendary | Level 20
phunction wrote:... Is there a way they can just authorize my app so I don't have to deal with the login part? ...
phunction take a look on the line where refresh token is referred to. Once you got to this token, next time you can skip actual login part and process directly the client creation. Owning the token keeps you (your application actually) logged in corresponding account, where you have logged in already before. 😉
Greg-DB may be a good idea new feature providing serialization/deserialization of current client tokens status. This would provide an easier way for managing most recent state (keep/restore). Is .NET SDK the only kit that missing this feature? 🤔
About Discuss Dropbox Developer & API
Make connections with other developers
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!