System.AggregateException {"No auth method found"}
I'm currently adding dropbox file sharing to an application I'm working on, and I have it setup to get the auth key from the user, and then it stores the auth key in the user registry. Now I'm having issues when trying to get user profile data.
It keeps throwing "System.AggregateException" with the inner Exception of {"No auth method found"} on the line: "var accountInfo = await client.Core.Accounts.AccountInfoAsync();" This is the relevant piece of code:
public static void init()
{
if (!RegistryManager.HasKey("DropboxAuth"))
new DropboxAuth(); //DropboxAuth is a winform with a web brower element that the user uses to login and get their auth token
else
{
authKey = RegistryManager.GetKey("DropboxAuth");
InitClient().Wait();
}
}
private static async Task InitClient()
{
client = new Client(DropboxAuth.options);
var authRequestUrl = await client.Core.OAuth2.AuthorizeAsync("code");
var token = await client.Core.OAuth2.TokenAsync(authKey);
// Get account info -- error on this line
var accountInfo = await client.Core.Accounts.AccountInfoAsync();
Console.WriteLine("Uid: " + accountInfo.uid);
Console.WriteLine("Display_name: " + accountInfo.display_name);
Console.WriteLine("Email: " + accountInfo.email);
initialized = true;
}
I know that the user's auth token is being returned correctly, so I'm not sure where the auth error is coming from.
You shouldn't authorize your client more than once - after you get the token, you can just pass it as part of the Options object. No need to call Authorize/Token again