简体   繁体   English

没有提示和文件共享的DropNet身份验证

[英]DropNet Authentication without prompts and File Sharing

Couple of questions: 几个问题:

  1. I implemented the authentication process with DropNet. 我使用DropNet实施了身份验证过程。 My desktop application is designed for end-users. 我的桌面应用程序是为最终用户设计的。 Every time the application is launch the little browser window pops up asking the user to confirm access... Is there any way that end-user with SOME SORT of saved credentials (or user Code +user Secret, or API code + API secret) will be able to invoke the application and not be prompted by browser form (that currently requires login - if access token expired - or confirmation)? 每次启动该应用程序时,都会弹出一个浏览器小窗口,要求用户确认访问权限...最终用户是否以某种方式保存了凭据(或用户代码+用户密码,或API代码+ API密码)将能够调用该应用程序,而不会被浏览器形式提示(当前需要登录-如果访问令牌已过期-或确认)?

  2. The goal of my application is file sharing - that is, one end user may send URL (to the file that he uploaded to DropBox) to another user and the latter should be able to download the file by clicking on the link (without any prompts, exactly like in manual process of sharing link to the file in DropBox). 我的应用程序的目标是文件共享-也就是说,一个最终用户可以将URL(发送到他上传到DropBox的文件)发送给另一个用户,后者应该能够通过单击链接下载文件(没有任何提示) ,就像在手动过程中共享指向DropBox中文件的链接一样。 Is it possible? 可能吗? If yes, how to achieve that? 如果是,该如何实现? THat is how do I get that URL? 请问如何获取该URL? Redandent to say that I am looking for a programmatic way to obtain a URL that will achieve the above described) 表示我正在寻找一种编程方式来获取将实现上述功能的URL)

Thanks guys, thanks for the tips, now work, The file is uploaded to a folder within the dropbox app, here's the code: 谢谢大家,感谢您的提示,现在可以工作了,文件已上传到Dropbox应用程序内的文件夹中,代码如下:

Dim client As DropNetClient
    Dim dropboxLoggedIn As Boolean = False
    Dim dropboxAsecret
    Dim dropboxAtoken
    Dim token As UserLogin
    Dim url As String = ""

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


        client = New DropNetClient("xxxxxx", "xxxxxxx")
        client.UseSandbox = True

        Dim login = client.UserLogin

        token = client.GetToken()
        url = client.BuildAuthorizeUrl()

        Process.Start(url)

    End Sub


    Private Sub ButtonX2_Click(sender As Object, e As EventArgs) Handles ButtonX2.Click

        client.GetAccessToken()
        dropboxAsecret = client.UserLogin.Secret
        dropboxAtoken = client.UserLogin.Token


        Try
            Dim rawData As Byte() = File.ReadAllBytes("c:\flor_lotus.png")
            Dim result As MetaData = client.UploadFile("/geral", "flor_lotus.png", rawData)
        Catch ex As DropNet.Exceptions.DropboxException
            MessageBox.Show(ex.Message)
        End Try

    End Sub

For starters, please read the API documentation for the Dropbox API. 对于初学者,请阅读Dropbox API的API文档。 https://www.dropbox.com/developers/core/docs It will answer some of your questions for you. https://www.dropbox.com/developers/core/docs它将为您解答一些问题。

  1. Yes it is possible to save the authentication token to save the user logging in every time. 是的,可以保存身份验证令牌以保存每次登录的用户。 At the end of the authentication process after calling GetAccessToken() the DropNetClient instance will have a property called UserLogin this contains a User token and secret. 在身份验证过程结束后,调用GetAccessToken() ,DropNetClient实例将具有一个名为UserLogin的属性,其中包含用户令牌和密钥。 Store these, then next time you create an instance of the DropNetClient user the constructor that takes these as parameters. 存储这些,然后在下次创建DropNetClient用户的实例时,将其作为参数的构造函数。

  2. The API has the ability to get a share link for a file. 该API可以获取文件的共享链接。 This is exposed by DropNet with the GetShare and GetShareAsync methods. 这是由DropNet使用GetShareGetShareAsync方法公开的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM