You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
nashworth
4 years agoHelpful | Level 5
UWP Webview and Token Authorization
Since Dropbox has decided to nix support for Edge 18, which has made the UWP Webview control useless for authorization to get a token, is there a workable solution for UWP?
I have not found a w...
Andrey K.1
Helpful | Level 5
Hi Greg!
If you highly recommend updating our app to use the system browser as documented, is it possible to get simple sample how to do this in UWP?
I need ANY help. I spent many days for trying to get help from your documentation, wrote two tickets, but couldn't find working docs for UWP.
Since October our customers couldn't use our app for connecting to their data in Dropbox.
And, please, remove samples for universalDemo from https://www.dropbox.com/developers/documentation/dotnet
It's completely useless for UWP now.
Greg-DB
4 years agoDropbox Staff
Andrey K.1 Thanks for the feedback! I've sent this to the team to get the examples updated, but I can't offer a timeline for that.
It seems that using a custom URL scheme with the PKCE flow works though. I don't have an official example to offer, but while I'm not a UWP programmer myself, it looks like the necessary pieces work in my testing. For instance:
First, I define a redirect URI using a custom URI scheme:
private readonly Uri RedirectUri = new Uri("customappurl://redirect_receiver/");
The "customappurl" is just an example. You should use something unique and specific to your app instead. The "redirect_receiver" can also be whatever you want.
Then I register that custom URI scheme in the UWP app as covered in Microsoft's 'Handle URI activation' documentation, and the redirect URI for the Dropbox API app on the Dropbox App Console.
Then I can configure the PKCE flow otherwise as shown in the existing example and get the authorization URL and launch that authorization URL in the system browser as shown in the Microsoft 'Launch the default app for a URI' documentation:
var OAuthFlow = new PKCEOAuthFlow();
var authorizeUri = OAuthFlow.GetAuthorizeUri(OAuthResponseType.Code, ApiKey, RedirectUri.ToString(), state: state, tokenAccessType: TokenAccessType.Offline, scopeList: scopeList, includeGrantedScopes: includeGrantedScopes);
var success = await Windows.System.Launcher.LaunchUriAsync(authorizeUri);
if (success)
{
// URI launched
System.Diagnostics.Debug.WriteLine("Launching authorize URI succeeded.");
}
else
{
// URI launch failed
System.Diagnostics.Debug.WriteLine("Launching authorize URI failed.");
}
That opens the authorization page in the system browser, and after the user authorizes the app, I can receive the resulting redirected URI as eventArgs.Uri in OnActivated per the Microsoft 'Handle URI activation' documentation. That should be passed to ProcessCodeFlowAsync like redirectUri is in the existing example.
Hope this helps!
- Andrey K.14 years agoHelpful | Level 5
Thanks, Greg.
It really helps!
At last, are there any options to close a browser page https://www.dropbox.com/oauth2/authorize... with Cancel/Allow buttons after authorization?
- Greg-DB4 years agoDropbox Staff
Thanks for following up. No, unfortunately I don't believe there's a way to close that page. I'll send this along to the team to see if we can improve this in the future, but I can't make any promises.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days 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!