How to create Oauth2 Rediret URI using Dropbox API in C#?

Asked

Viewed 77 times

-1

I’m having trouble connecting to DropBox using a Console Application of C# and tried to create a Redirect URIs in my profile app on the website of Dropbox, but I don’t understand much.

In my app, I have http registered

inserir a descrição da imagem aqui

When I try to run the application through Visual Studio, I get authentication error.

I have the code to follow

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        if(String.IsNullOrEmpty(Properties.Settings.Default.AccessToken))
        {
            this.GetAccessToken();
        }
        else
        {
            this.GetFiles();
        }
    }

    private void GetAccessToken()
    {
        var login = new DropboxLogin("wbjcj6pa94berli", appKey, "https://www.dropbox.com/developers/apps/info/wbjcj6pa94berli", false, false);
        login.Owner = this;
        login.ShowDialog();

        if (login.IsSuccessfully)
        {
            Properties.Settings.Default.AccessToken = login.AccessToken.Value;
            Properties.Settings.Default.Save();
        }
        else
        {
            MessageBox.Show("Error...");
        }
    }

    private void GetFiles()
    {

    }
}

The truth is I don’t know what to put in this URI, someone can help me?

1 answer

0

there is an example application in the Dropbox github to show the use of SDK in the application console, there are also other examples for MVC and for Windows 10 Apps:

Dropbox_simpletest

Apparently he used an Httpclient and an HTML page to get the token via JS, see if the example of the guys helps you to use the SDK. You can find more details of the SDK documentation here:

Dropbox Dotnet SDK

Browser other questions tagged

You are not signed in. Login or sign up in order to post.