【问题标题】:Twitter Authentication - NO PIN codebirdTwitter 身份验证 - 没有 PIN 码鸟
【发布时间】:2015-11-19 11:08:55
【问题描述】:

我遇到了身份验证问题!我使用以下代码得到 401

<script src="codebird.js"></script>
<script>
var cb          = new Codebird;
cb.setConsumerKey("xxx", "xxx");
function autht(){
    cb.__call(
        "oauth_requestToken",
        {oauth_callback: "http://snipleecast.com/index2.php"},
        function (reply,rate,err) {
            if (err) {
                console.log("error response or timeout exceeded" + err.error);
            }
            if (reply) {
                // stores it
                cb.setToken(reply.oauth_token, reply.oauth_token_secret);

                // gets the authorize screen URL
                cb.__call(
                    "oauth_authorize",
                    {},
                    function (auth_url) {
                        window.codebird_auth = window.open(auth_url);
                    }
                );
            }
        }
    );  
}

<?php if ( isset ( $_GET['oauth_verifier'] ) ){
    ?>

        // assign stored request token parameters to codebird here
        // ...
        cb.setToken(something, something2);

        cb.__call(
            "oauth_accessToken",
            {
                oauth_verifier: '<?php echo $_GET['oauth_verifier']; ?>'
            },
            function (reply, rate, err) {
                if (err) {
                    console.log("error response or timeout exceeded" + err.error);
                }
                if (reply) {
                    cb.setToken(reply.oauth_token, reply.oauth_token_secret);
                    alert('<?php echo $_GET['oauth_verifier']; ?>');
                }

                // if you need to persist the login after page reload,
                // consider storing the token in a cookie or HTML5 local storage
            }
        );
    <?php
}
?>

我点击一个按钮,它启动了 twitter oauth 页面,但是一旦它返回我的主页,什么都没有发生 :( 只是 401 错误。

IDK 我做错了什么:(

【问题讨论】:

    标签: javascript twitter


    【解决方案1】:

    没关系抱歉,伙计们想通了!好像我失踪了

    "oauth_accessToken",
                {
                    oauth_token: '<?php echo $_GET['oauth_token']; ?>',
                    oauth_verifier: '<?php echo $_GET['oauth_verifier']; ?>'
                },
    

    【讨论】:

      猜你喜欢
      • 2016-06-05
      • 1970-01-01
      • 2011-12-07
      • 2015-06-07
      • 1970-01-01
      • 2014-03-22
      • 2013-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多