Problem authenticating to Evernote With .Net SDK

吃可爱长大的小学妹 提交于 2020-03-04 15:58:05

问题


I'm trying to access Evernote from a custom app in .NET (4.6.1) on Windows (both Evernote client and SDK installed), but nada. I got an API key, with full access, I'm registered in Sandbox, and still, authentication fails.

I tried the official method:

  ENSession.SetSharedSessionConsumerKey(consumerKey, consumerSecret);
    if (!ENSession.SharedSession.IsAuthenticated)
      ENSession.SharedSession.AuthenticateToEvernote();

Authentication doesn't happen and IsAuthenticated remains to false. Using ENSessionAdvanced (that I should use) does not change things.

I also tried adding the session host:

ENSessionAdvanced.SetSharedSessionConsumerKey(consumerKey, consumerSecret,"sandbox.evernote.com");
  if (!ENSessionAdvanced.SharedSession.IsAuthenticated)
    ENSessionAdvanced.SharedSession.AuthenticateToEvernote();

Again, nothing.

An alternative method also doesn't work:

EvernoteOAuth oAuth = new EvernoteOAuthNet.EvernoteOAuth(EvernoteOAuthNet.EvernoteOAuth.HostService.Sandbox, consumerKey, consumerSecret, true);
string errorResponse = oAuth.Authorize();
if (!string.IsNullOrEmpty(errorResponse)) {
  ENSessionAdvanced.SetSharedSessionDeveloperToken(oAuth.Token, oAuth.NoteStoreUrl);

I get an errorResponse of "Errore del server remoto: (401) Non autorizzato." (Error on remote server: (401) Not authorized.)

Evernote support is absent. Some pitiful soul here? Even if I suspect that only Evernote can tell why the authorization is not given...

来源:https://stackoverflow.com/questions/60185006/problem-authenticating-to-evernote-with-net-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!