Dropbox的API"用户令牌","用户的机密" [英] Dropbox api "USER TOKEN", "USER SECRET"

查看:737
本文介绍了Dropbox的API"用户令牌","用户的机密"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用DropNet客户端(C#版的Dropbox客户端API)操作使用Dropbox的API文件。这是我的code:

I am trying manipulate files using Dropbox Api by using DropNet Client (C# version of Dropbox CLient API). Here is my code:

    var client = new DropNetClient(APP_KEY,APP_SECRET);
    client.Delete("/Public/test.txt");

但似乎我需要用户令牌和用户的机密为好。我应该从哪里得到这两个? 更新: 我只需要在自己的文件夹和我的共享文件夹操作文件。我已经有APP_KEY和APP_SECRET从对myApp页,我在哪里可以得到用户令牌和用户的机密

But it seems I need "USER TOKEN" and "USER SECRET" as well. Where should I get these two? Updated: I just need to manipulate files in my own folders and my shared folders. I already have APP_KEY and APP_SECRET from myApp page, where can I get "USER TOKEN" and "USER SECRET"

感谢

推荐答案

当你创建你的Dropbox的网站应用程序,他们给你一个APP_KEY(标识您的应用程序)和APP_SECRET(如密码)。你基本上与注册下拉框,您的应用程序,以便与他们的服务集成。

When you create your app on the dropbox web site, they give you an APP_KEY (identifies your app) and an APP_SECRET (like a password). You're essentially registering your app with drop box in order to integrate with their service.

下面是一个简要介绍: <一href="http://www.dropbox.com/developers/start/core">http://www.dropbox.com/developers/start/core

Here's an overview: http://www.dropbox.com/developers/start/core

点击该页面中的我的应用链接。你必须创建或与您的下拉框帐号登录。在此之后,您可以创建一个应用程序。给它一个名称和描述,选择访问文件夹或全部内容,然后单击确定。他们会给你注册你的应用程序后,密钥和密码。

Click the "my apps" link in that page. You'll have to create or login with your drop box account. After that, you can create an app. Give it a name and description, select access folder or full contents and click OK. They will give you the key and secret after registering your app.

编辑:

说到具体的C#DropNetClient,你应该取代APP_KEY和APP_SECRET与您APPKEY和appSecret串从该网站。

Concerning the specific C# DropNetClient, you're supposed to replace "APP_KEY" and "APP_SECRET" with your appKey and appSecret strings from that site.

这个链接,勾画出序列pretty的明确:

This link lays out the sequence pretty clearly:

https://github.com/dkarzon/DropNet

_client = new DropNetClient("API KEY", "API SECRET");

例如:

// replace with given app key and secret from site
_client = new DropNetClient("8oz68cz267t52fz", "mavm58321hrhejy");

一旦你有一个客户端对象,你需要弹出一个浏览器,并让用户登录到下拉框与他们的用户帐户。这些受获取链接覆盖在该链路的步骤2

Once you have a client object, you need to pop a browser and have the user login to drop box with their user account. that's covered in step 2 of that link by getting the url.

var url = _client.BuildAuthorizeUrl();

现在该用户已登录,就可以得到通过同步或异步的方式在用户访问令牌。用户令牌使记住我的功能,而无需从您的应用程序存储他们的帐户名/密码,你应该永远不会做用户重新进行身份验证,尤其是。这是证明他们已经用下拉框验证令牌。从该链接的步骤3:

Now that the user has logged on, you can get a user access token via synchronous or asynchronous methods. the user token enables a "remember me" feature without having the user reauthenticating and especially from your app storing their account/pass which you should never do. It's a token that proves they've authenticated with drop box. From step 3 of that link:

// Sync
var accessToken = _client.GetAccessToken(); //Store this token for "remember me" function

// Async
_client.GetAccessTokenAsync((accessToken) =>
    {
        //Store this token for "remember me" function
    },
    (error) =>
    {
        //Handle error
    });

需要注意的是VAR accessToken确实是一个DropNet.Models.UserLogin对象。该对象包含:

Note that var accessToken is really a DropNet.Models.UserLogin object. That object contains:

    public string Token { get; set; }
    public string Secret { get; set; }

这篇关于Dropbox的API&QUOT;用户令牌&QUOT;,&QUOT;用户的机密&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆