2017-02-22 46 views
0

我有一个问题,关于Instagram Api oAuth。创建一个小api,用户允许生成一个instagram api令牌密钥。但是,我的问题是,当我用我的帐户登录时,源代码有效。但是,当别人用不同的帐户想要进去。回到这里:instagram api - oAuth - 用户得到沙箱

{"error_message": "You are not a sandbox user of this client", "error_type": "OAuthForbiddenException", "code": 403} 

我不知道,到底是什么问题是?也许在有效的重定向URI?我在那里有相同的网址,如网址?我需要在网址的末尾提交吗?什么?我已经读过文件:instagram.com/ oAuth。我按照这些步骤:

第一:

签了我的开发者帐号:

然后注册一个新的客户端:

网站网址:mywebsitecom /标记/

有效重定向URI:mywebsitecom /令牌/

该应用应该如此工作:用户点击按钮>>然后它会在转发到oauth >>授权应用后>>用户将在同一页面或站点上获得令牌密钥website/token/#access_token=1920579593.4ca8793.a66f6aa9d40243afa282735f707b58b3

我该怎么做?我不知道,这里的problme是.. 应用程序是禁用隐含的OAuth:

这里是我的源:

<!doctype html> 
<html class="no-js" lang="en"> 
    <head> 

     <meta charset="utf-8"> 
     <meta http-equiv="X-UA-Compatible" content="IE=edge"> 

     <title>Instagram API Access Token KEY Generator – by Lucas Gatsas</title> 

     <link rel="icon" type="image/png" href="images/favicon.png"> 

     <meta name="description" content="Quickly generate an access token for Instagram to display your photos on your website."> 
     <meta name="viewport" content="width=device-width, initial-scale=1"> 
     <script src="assets/js/javascript.modify.js"></script> 
     <link rel="stylesheet" type="text/css" href="assets/css/stylesheet.css"> 

     <script type="text/javascript"> 

      (function(){$(function(){var n,t,o,c;return c=function(){return o()?($(document.body).addClass("token-received"),t()):$(document.body).addClass("no-token"),n()},o=function(){var n;return n=window.location.hash,!!(n.length&&n.indexOf("access_token")>-1)},t=function(){var n;return n=window.location.hash.split("#access_token=")[1],$(".instagram-access-token").val(n).on("click",function(){return $(this).select()})},n=function(){return Modernizr.svg?void 0:$(".logo").attr("src",$(".logo").data("backup-png"))},c()})}).call(this); 
     </script> 
    </head> 
    <body> 

     <div class="site-header-wrapper"> 
      <header class="site-header" role="banner"> 
       <img src="assets/img/Instagram-logo.png" style=" width 200px; 
        display contents; 
        margin 0 auto; 
        text-align center; 
        display -webkit-box;"> 

      </header> 
     </div> 
     <div class="site-content-wrapper"> 
      <div class="site-content" role="main"> 
       <div class="pre-token"> 
        <div class="token-button-wrapper"> 
         <a href="https://www.instagram.com/oauth/authorize/?client_id=6ca879341cd14455bd12f4fb93515ed9&redirect_uri=http://lucasgatsas.ch/token/&response_type=token" class="button" title="Generate Instagram Access Token">Generate Token Key</a> 
        </div> 

        <p>You'll be brought right back here and, if all went well, your Instagram Access Token will be ready for you. Copy and paste this access token into the correct field. Remember to keep your access token private and never paste it in a location where others might can access it.</p> 
        <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://lucasgatsas.ch/token" data-text="Check Out the Instagram Access Token Api Key Generator" data-size="large" data-hashtags="instagram">Tweet</a> 
        <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> 
        <code> 
         https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token 
        </code> 
        <h1>Docu:</h1> 
        <p><a href="https://www.instagram.com/developer/" target="_blank">Instagram Developers</a></p> 
        <p><a href="https://www.instagram.com/developer/authentication/" target="_blank">oAuth2 - Authentication</a></p> 
        <p><a href="https://www.instagram.com/developer/authentication/" target="_blank">oAuth2 - Authentication</a></p> 

        <h1>Links:</h1> 
        <p><a href="https://tools.ietf.org/html/draft-ietf-oauth-v2-12" target="_blank">oAuth V.2</a></p> 
        <div class="post-token"> 
         <h2>It worked!</h2> 
         <p>Use this token in the appropriate field on your website or blog, and you should have a working Instagram widget.</p> 
         <div class="token-input-wrapper"> 
          <input class="instagram-access-token" type="text" value="" size="50"> 
         </div> 
         <p>Are you have any Question to the Api Token Key. Please feel free to contact me <a href="mailto:[email protected]">Contact Me.</p> 
        </div> 
       </div> 
      </div> 

      <div class="site-footer-wrapper"> 
       <footer class="site-footer"> 
        <p>©.2017 by <a href="http://lucasgatsas.ch">Lucas Gatsas</a></p> 
       </footer> 
      </div> 

      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
      <script>window.jQuery || document.write("<script src='scripts/jquery-1.11.1.min.js'><\/script>")</script> 
      <script type="text/javascript"> 
       (function() { $(function() { var n, t, o, c; return c = function() { return o() ? ($(document.body).addClass("token-received"), t()) : $(document.body).addClass("no-token"), n() }, o = function() { var n; return n = window.location.hash, !!(n.length && n.indexOf("access_token") > -1) }, t = function() { var n; return n = window.location.hash.split("#access_token=")[1], $(".instagram-access-token").val(n).on("click", function() { return $(this).select() }) }, n = function() { return Modernizr.svg ? void 0 : $(".logo").attr("src", $(".logo").data("backup-png")) }, c() }) }).call(this); 
      </script> 
    </body> 
</html> 

希望有人能给我建议吗?

回答

0

您的客户不能被每个用户访问。您需要邀请您正在测试的用户作为“沙盒用户”。

导航到“管理客户端”,然后单击您想使用的客户端的“管理”。选择选项卡“沙盒”并添加您正在测试的用户。

正如你所看到的,你自己的帐户是由Instagram默认添加的。

祝你好运

+0

非常感谢,听起来不错,直到现在还没有完成项目,但我现在会尝试。如果确实有效,回到你身边。和平L. – user3061844