2016-11-12 17 views
0

私はtrello APIで作業する必要がありますが、エラー400(無効なトークン)が表示されています。理由はわかりません。
これはTrello api無効なトークン

<html> 
    <head> 
    <title>A Trello Dashboard</title> 
    <link rel="stylesheet" media="screen" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> 
    </head> 
    <body> 
    <div class="container"> 
     <h1>Trello Dashboard</h1> 
    </div> 
    </body>  

    <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> 
    <script src="https://trello.com/1/client.js?key=mykey"></script> 

    <script type="text/javascript"> 
    Trello.authorize({ 
     type: 'popup', 
     name: 'A Trello Dashboard', 
     scope: { 
     read: 'true', 
     write: 'true' 
     }, 
     expiration: 'never', 
     success: function() { console.log("Successful authentication"); }, 
     error: function() { console.log("Failed authentication"); } 
    }); 
    </script> 
</html> 

答えて

0

文書全体が準備されますので、あなたは、document.ready内のすべてのコードのロジックを置く必要があり、その後にのみ、あなたがポップアップを取得します(私はmykeyと私の実際のキーを交換した)私のコードです認証/認可のために。あなたはここで有効なアプリのキーを取得することができます:https://trello.com/app-keyコード例を参照してください:URL参照

<html> 
    <head> 
    <title>A Trello Dashboard</title> 
    <link rel="stylesheet" media="screen" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> 
    </head> 
    <body> 
    <div class="container"> 
     <h1>Trello Dashboard</h1> 
    </div> 
    <div id="loggedin"> 
    <div id="header"> 
     Logged in to as <span id="fullName"></span> 
    </div> 

    <div id="output"></div> 
</div>  

    </body>  

    <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> 
    <script src="https://api.trello.com/1/client.js?key=[appKeygoeshere]"></script> 

    <script type="text/javascript"> 
    $(window).load(function(){ 
    Trello.authorize({ 
     type: 'popup', 
     name: 'A Trello Dashboard', 
     scope: { 
     read: 'true', 
     write: 'true' 
     }, 
     expiration: 'never', 
     success: function() { console.log("Successful authentication"); 
      Trello.members.get("me", function(member){ 
      $("#fullName").text(member.fullName); 

      var $cards = $("<div>") 
       .text("Loading Cards...") 
       .appendTo("#output"); 

      // Output a list of all of the cards that the member 
      // is assigned to 
      Trello.get("members/senthil192/cards/all", function(cards) { 
       $cards.empty(); 
       $.each(cards, function(ix, card) { 
        //alert(card.name); 
        $("<a>") 
        .attr({href: card.url, target: "trello"}) 
        .addClass("card") 
        .text(card.name) 
        .appendTo($cards); 
       }); 
      }); 
     }); 
     }, 
     error: function() { console.log("Failed authentication"); } 
    }); 
    }); 

    </script> 

</html> 

コード:http://jsfiddle.net/danlec/nNesx/

関連する問題