B4J Question how use OAuth2 class for dropbox ??

behnam_tr

Active Member
Licensed User
Longtime User
how use OAuth2 class for dropbox ??
for upload and download file from dropbox

i test any other dropbox libs for b4j but without result

also i want to any user could upload to his account form this app

 

behnam_tr

Active Member
Licensed User
Longtime User
solved
thanks @DonManfred for publishing Dropbox API V2. All HTTP! and @Erel For Google OAuth2 class

Dropbox OAuth2 class + download,upload,get Account info and ......
you can add other functions from DonManfred class
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
B4X:
Public Appkey As String  = "your app key"
Public AppSecret As String   = "your app secret"

    Private dpx As DropboxOAuth2
    dpx.Initialize(Me, "dpx", Appkey, "account_info.read account_info.write contacts.write file_requests.read file_requests.write files.content.read files.content.write files.metadata.read files.metadata.write sharing.read sharing.write", AppSecret, File.DirData("Dropbox"))
    dpx.GetAccessToken
    Wait For dpx_AccessTokenAvailable (Success As Boolean, token As String)
    If Success = True Then
        Log("user token="&token)
        Get_Account_info
    Else
        Log("Error accessing account.")
       
    End If


B4X:
Sub Get_Account_info
   
    dpx.GetCurrentAccount
    Wait For dpx_CurrentAccount(meta As Map,success As Boolean)
    If success Then
        Log("meta is = "&meta)
        Log($"Email is : ${meta.Get("email")}"$)
        Dim names As Map = meta.Get("name")
        Log($"your name is : ${names.Get("display_name")}"$)
       
    End If
   
   
       
End Sub


B4X:
'Uploading File

dpx.Upload(File.DirData("Padina"),newFilename,"",newFilename)
        Wait For dpx_UploadFinished(Resultmap As Map,success As Boolean)
        If success Then
            Log(Resultmap)
        End If
 

Attachments

  • DropboxOAuth2.bas
    15 KB · Views: 249
Upvote 0
Top