【问题标题】:How to authenticate with Evernote developer account with OAuth.io如何使用 OAuth.io 对 Evernote 开发者帐户进行身份验证
【发布时间】:2016-03-14 13:01:26
【问题描述】:

我的任务是创建 将使用 Evernote 帐户数据的 SPA。对于身份验证,我想使用 Oauth.io 服务。 Oauth.io 网站上的“Try auth”按钮工作正常。我看到提示登录的弹出窗口。

在我的应用程序 html 中,我有一个简单的按钮:

<button id="login-evernote-btn" type="button" class="bx-button bx-button-accept" onclick="app.loginWithEvernote();"><i class="fa fa-sign-in"></i> Evernote Login</button>

和我的 JS 应用程序:

//Constructor
function Application() {
    OAuth.initialize('HERE_PASTE_MY_PUBLIC_KEY');
};

/*----------------------------*/
/*    Application methods     */
/*----------------------------*/

Application.prototype.loginWithEvernote = function() {

    OAuth.popup('evernote', function(error, success){

    });
};

// Create application Object
app = new Application();

但是在单击我的按钮后,我看到启动窗口会在第二秒关闭。我无法输入我的凭据。

我在哪一步做错了?

认证成功后,我想使用 Evernote API 列出所有笔记。

【问题讨论】:

    标签: javascript html evernote


    【解决方案1】:

    您需要记录错误以查看弹出窗口的问题。那可能是域白名单或使用“evernote”提供程序而不是“evernote_sandbox”

    根据github上的evernote-sdk-js,你可以这样使用你的token

    Application.prototype.loginWithEvernote = function() {
        OAuth.popup('evernote').done(function(evernote) {
    
            var client = new Evernote.Client({token: evernote.oauth_token});
            var noteStore = client.getNoteStore();
            notebooks = noteStore.listNotebooks(function(err, notebooks) {
               // run this code
            });
    
        }).fail(function(e) {
            console.error(e)
        });
    };
    

    【讨论】:

      猜你喜欢
      • 2017-03-20
      • 1970-01-01
      • 2011-06-30
      • 2022-10-04
      • 1970-01-01
      • 1970-01-01
      • 2013-05-08
      • 1970-01-01
      • 2020-06-24
      相关资源
      最近更新 更多