【发布时间】:2017-02-22 16:47:05
【问题描述】:
我有一个关于 Instagram Api oAuth 的问题。创建一个小 api,用户允许生成一个 instagram api 令牌密钥。但是,我的问题是,当我使用我的帐户登录时,源代码有效。但是,当使用不同帐户的其他人想要登录时,请收回:
{"error_message": "You are not a sandbox user of this client", "error_type": "OAuthForbiddenException", "code": 403}
我不知道,到底是什么问题?也许在有效的重定向 URI 中?我有与网站网址相同的网址吗?我必须在网址末尾提交吗?某物?我已阅读文档:instagram.com/oAuth。我按照以下步骤操作:
第一:
注册我的开发者帐户:
然后注册一个新的客户端:
网站网址:mywebsitecom/token/
有效的重定向 URI:mywebsitecom/token/
应用程序应该这样工作:用户单击按钮>>然后它将转发到oauth >>在授权应用程序后>>用户将在同一页面或站点上获得令牌密钥website/token/#access_token=1920579593.4ca8793.a66f6aa9d40243afa282735f707b58b3
我该怎么做?我不知道,问题在哪里.. 该应用程序具有禁用隐式 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:space@lucasgatsas.ch">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>
希望有人能给我一些建议吗?
【问题讨论】: