Dropbox on .NET Maui

Phunction 206 Reputation points
2024-05-12T21:27:18.04+00:00

I am trying to get Dropbox to work in .net maui.

I have it working fine in xamarin.ios, it open a browser and get them to login, then when the go back from the browser, the app is receives the redirect in appdelegate.cs to get the auth token and use it to allow the user to access their files.

I am unable to find a way to do that in .net maui. How do I handle the redirect from the browser?

(I can't use webview as dropbox no longer allows that.)

The xamarin.ios parts, this is in the view where I start the dropbox stuff:

NSNotificationCenter.DefaultCenter.AddObserver(new NSString("DropboxAuthorizationCodeNotification"), HandleAuthorizationNotification);

And this in appdelegate.cs:

public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
...
NSDictionary userInfo = NSDictionary.FromObjectAndKey(new NSString(authorizationCode), new NSString("AuthorizationCode"));
NSNotificationCenter.DefaultCenter.PostNotificationName("DropboxAuthorizationCodeNotification", null, userInfo);
...

I am not sure how to recreate this in .net maui and I can't find any examples of using dropbox as they all refer to using webview, which isn't allowed anymore.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,978 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,390 questions
{count} votes