简单的C#Evernote API OAuth示例或指南?

简单的C#Evernote API OAuth示例或指南?,c#,oauth,evernote,C#,Oauth,Evernote,有人知道我在哪里可以找到一个简单的C代码示例吗?显然很难找到 我刚开始,拿到了我的开发者密钥 初始(实际上是noob问题/假设)——我的解决方案可以(应该/必须)是web服务客户机吗?我不需要在.Net中安装新库,对吗 基本上,作为一项测试,我希望能够安全地以html格式呈现私人笔记本中的一张便笺,类似于外部网站上的Everfort导出html格式 非常感谢 您应该从下载我们的API ZIP开始。您可以在/sample/csharp中找到C#客户机示例代码。此示例代码演示如何从使用用户名和密码进

有人知道我在哪里可以找到一个简单的C代码示例吗?显然很难找到

我刚开始,拿到了我的开发者密钥

初始(实际上是noob问题/假设)——我的解决方案可以(应该/必须)是web服务客户机吗?我不需要在.Net中安装新库,对吗

基本上,作为一项测试,我希望能够安全地以html格式呈现私人笔记本中的一张便笺,类似于外部网站上的Everfort导出html格式


非常感谢

您应该从下载我们的API ZIP开始。您可以在/sample/csharp中找到C#客户机示例代码。此示例代码演示如何从使用用户名和密码进行身份验证的桌面应用程序中使用Evernote API。

可能会有所帮助。正如作者所说,它只是捆绑了一些并修复了一些。我自己也没有试过,但我想我会提到一个可能更容易开始的方法。可能。

这可能也有帮助……因为原始博客网站处于脱机状态,所以使用Way Back机器找到它

原始博文:


向下滚动并找到12月26日发布的帖子-“趁热获取…”

我不确定你是否能实现这一点,但今天早上我与Evernote、OpenAuth和C#一起玩了一圈,并成功地实现了这一点。我在这里整理了一篇博客文章/库,解释了使用MVC的经验并概述了如何使用MVC——它使用AsyncOAuth库:

我围绕AsyncOAuth编写了一个包装器,在这里您可能会发现它很有用:

需要注意的一件棘手的事情是,Evernote端点(/oauth和/oauth.action)区分大小写

// Download the library from https://github.com/shaunmccarthy/AsyncOAuth.Evernote.Simple

// Configure the Authorizer with the URL of the Evernote service,
// your key, and your secret. 
var EvernoteAuthorizer = new EvernoteAuthorizer(
    "https://sandbox.evernote.com", 
    "slyrp-1234", // Not my real id / secret :)
    "7acafe123456badb123");

// First of all, get a request token from Evernote - this causes a 
// webrequest from your server to Evernote.
// The callBackUrl is the URL you want the user to return to once
// they validate the app
var requestToken = EvernoteAuthorizer.GetRequestToken(callBackUrl);

// Persist this token, as we are going to redirect the user to 
// Evernote to Authorize this app
Session["RequestToken"] = requestToken;

// Generate the Evernote URL that we will redirect the user to in
// order to 
var callForwardUrl = EvernoteAuthorizer.BuildAuthorizeUrl(requestToken);

// Redirect the user (e.g. MVC)
return Redirect(callForwardUrl);

// ... Once the user authroizes the app, they get redirected to callBackUrl

// where we parse the request parameter oauth_validator and finally get
// our credentials
// null = they didn't authorize us
var credentials = EvernoteAuthorizer.ParseAccessToken(
    Request.QueryString["oauth_verifier"], 
    Session["RequestToken"] as RequestToken);

// Example of how to use the credential with Evernote SDK
var noteStoreUrl = EvernoteCredentials.NotebookUrl;
var noteStoreTransport = new THttpClient(new Uri(noteStoreUrl));
var noteStoreProtocol = new TBinaryProtocol(noteStoreTransport);
var noteStore = new NoteStore.Client(noteStoreProtocol);
List<Notebook> notebooks = client.listNotebooks(EvernoteCredentials.AuthToken);
//从下载库https://github.com/shaunmccarthy/AsyncOAuth.Evernote.Simple
//使用Evernote服务的URL配置授权人,
//你的钥匙,你的秘密。
var EvernoteAuthorizer=新的EvernoteAuthorizer(
"https://sandbox.evernote.com", 
“slyrp-1234”,//不是我的真实id/秘密:)
“7acafe123456badb123”);
//首先,从Evernote获取请求令牌-这会导致
//从服务器到Evernote的webrequest。
//callBackUrl是希望用户返回一次的URL
//他们验证应用程序
var requestToken=EvernoteAuthorizer.GetRequestToken(callBackUrl);
//保留此令牌,因为我们将把用户重定向到
//Evernote授权此应用
会话[“RequestToken”]=RequestToken;
//生成我们将在中重定向用户的Evernote URL
//命令
var callForwardUrl=EvernoteAuthorizer.BuildAuthorizeUrl(requestToken);
//重定向用户(例如MVC)
返回重定向(callForwardUrl);
// ... 一旦用户对应用程序进行身份验证,他们就会被重定向到callBackUrl
//在这里,我们解析请求参数oauth_validator并最终获得
//我们的证书
//null=他们没有授权我们
var credentials=EvernoteAuthorizer.ParseAccessToken(
Request.QueryString[“oauth\u验证器”],
会话[“请求令牌”]作为请求令牌);
//如何在Evernote SDK中使用凭据的示例
var noteStoreUrl=EvernoteCredentials.NotebookUrl;
var noteStoreTransport=newthttpclient(新Uri(noteStoreUrl));
var noteStoreProtocol=新的TBinaryProtocol(noteStoreTransport);
var noteStore=new noteStore.Client(noteStoreProtocol);
列表笔记本=client.listNotebook(EvernoteCredentials.AuthToken);