问题
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