cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Newbie Try to Make Some VB app

Newbie Try to Make Some VB app

Blue_Maniac
Explorer | Level 3
Go to solution

Hey Guys, Im new here, i need help. i trying to make vb app using dropbox as cloud storage, for team work.

 

I already read the dropbox blog but it confuse me. i cant read the flow or what variable i should change. i know the first step is get autorization for the account but the flow confuse me. what i should change or what i should do ? please help me

 

Imports Dropbox
Imports Dropbox.Api
Imports System.Threading
Imports System.Text




Public Class Form1
    Public Shared Function GetAuthorizeUri(
 clientId As String,
 Optional disableSignup As Boolean = False
) As Uri
    End Function

    Public Shared Function ParseTokenFragment(
    redirectedUri As Uri
) As OAuth2Response

    End Function

    Public Shared Function ProcessCodeFlowAsync(
code As String,
appKey As String,
appSecret As String,
Optional redirectUri As String = Nothing,
Optional client As MdiClient = Nothing
) As Task(Of OAuth2Response)
    End Function

End Class







1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution
The /redirect_receiver page you're using is just a blank page on dropbox.com for receiving the redirect. You'll want to send the user elsewhere or just close the browser after that, depending on what you want your app to do.

View solution in original post

7 Replies 7

Greg-DB
Dropbox Staff
Go to solution

As a first step, I recommend running the SimpleBlogDemo sample app and looking through how that works. For example, HomeController.cs shows how to use these methods to set up and process the OAuth app authorization flow.

Blue_Maniac
Explorer | Level 3
Go to solution
Thanks fo the advice, but after i tried it. i still dont know where to start, i know i need to capture user id and pass to log in to dropbox, second i need to capture the acces token. but i dont understand the flow from example you give. please give me more simple explanation, because im very very new to make vb app with connection to dropbox

Greg-DB
Dropbox Staff
Go to solution
Did you get the sample running and try it out? Where did you get stuck exactly?

Also, we have an OAuth guide here that should serve as a good primer for how the flow works:

https://www.dropbox.com/developers/reference/oauthguide

Blue_Maniac
Explorer | Level 3
Go to solution

hey i try your example, but it stuck when redirected to https://www.dropbox.com/1/oauth2/redirect_receiver white page and i cant catch the token acces and here i'm. but thanks by the way now i star to understand it

Imports System.Web
Imports System.Net
Imports System.Text
Imports System.Windows.Forms
Imports Dropbox
Imports Dropbox.Api


Public Class Form1


    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        'Be sure to replace this with your app key from dropbox.com/developers/apps.
        Dim clientID = "oxug9jwop2ktf38"

        ' The redirect URI you use doesn't really matter, so feel free to use something else,
        ' but this is one we've set up specifically for client-side apps to use.
        Dim redirectUri = New Uri("https://www.dropbox.com/1/oauth2/redirect_receiver")
        Dim uri = String.Format("https://www.dropbox.com/1/oauth2/authorize?response_type=token&redirect_uri={0}&client_id={1}", redirectUri, clientID)

        WebBrowser1.Navigate(uri)

    End Sub


    ' This method gets called when the WebBrowser control loads a new page.
    Private Sub webBrowser1_Navigated(sender As Object, e As WebBrowser)


        ' Make sure that this is our redirect page.
        If (e.Url.AbsoluteUri.StartsWith("https://www.dropbox.com/1/oauth2/redirect_receiver")) Then

        End If
        ' Parse out the access token from the URL fragment.
        Dim accessToken = HttpUtility.ParseQueryString(e.Url.Fragment.Substring(1))("acces_token")
        ' TODO: Save the access token somewhere so the user doesn't need to log in the next time!

        ' Make a call to /account/info to verify that the access token is working.
        Dim client = New WebClient()
        client.Headers("Authorization") = "Bearer " + accessToken
        Dim accountInfo = client.DownloadString("https://www.dropbox.com/1/account/info")
        MessageBox.Show("Account info: " + accountInfo)

    End Sub

    

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Me.alamat.Text = Me.WebBrowser1.Url.ToString
          End Sub
End Class

 

Greg-DB
Dropbox Staff
Go to solution
Can you elaborate on what you mean when you say you can't catch the access token? What specifically isn't working?

Blue_Maniac
Explorer | Level 3
Go to solution

the URI, after login, the flow should take me to page that contain acces token but when i done with login, the next page is blank and when i look the code, it should display a message box contain my account info using my acces token.  i already got the access token, but the problem is take it and store from url 

 

Greg-DB
Dropbox Staff
Go to solution
The /redirect_receiver page you're using is just a blank page on dropbox.com for receiving the redirect. You'll want to send the user elsewhere or just close the browser after that, depending on what you want your app to do.
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Blue_Maniac Explorer | Level 3
What do Dropbox user levels mean?