Forum Discussion

Blue_Maniac's avatar
Blue_Maniac
Explorer | Level 3
10 years ago
Solved

Newbie Try to Make Some VB app

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







  • Greg-DB's avatar
    Greg-DB
    10 years ago
    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.

7 Replies

  • Blue_Maniac's avatar
    Blue_Maniac
    Explorer | Level 3
    10 years ago
    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
  • Blue_Maniac's avatar
    Blue_Maniac
    Explorer | Level 3
    10 years ago

    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's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    10 years ago
    Can you elaborate on what you mean when you say you can't catch the access token? What specifically isn't working?
  • Blue_Maniac's avatar
    Blue_Maniac
    Explorer | Level 3
    10 years ago

    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's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    10 years ago
    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.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If 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, Facebook or Instagram.

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!