TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Does anyone else have problems with Instagram API OAuth2?

19 点作者 svens_超过 8 年前

28 条评论

xmrcivicboix超过 8 年前
To temporary fix the issue, you could do the following:<p>change response_type=code to response_type=token. Instagram will redirect back to your site with something like &#x2F;callback#access_token=123456. From here, send the user to a very simple page with the following snippet:<p>&lt;script&gt;<p><pre><code> if (window.location.hash &amp;&amp; window.location.hash.indexOf(&#x27;#access_token=&#x27;) !== -1) { var accessToken = window.location.hash.replace(&#x27;#access_token=&#x27;, &#x27;&#x27;); window.location = &#x27;&#x2F;callback?access_token=&#x27; + accessToken; } </code></pre> &lt;&#x2F;script&gt;<p>After that, you just use the Instagram API to retrieve user by access token then perform log in. This is not a recommended flow by Instagram but is a flow that works for now if your customers are constantly hammering you with support tickets as they did with us.
评论 #13225192 未加载
评论 #13215763 未加载
评论 #13201250 未加载
评论 #13203859 未加载
评论 #13203585 未加载
stefl超过 8 年前
I&#x27;ve managed to work around this by changing the API host name from &#x27;api.instagram.com&#x27; to &#x27;www.instagram.com&#x27; for the Oauth authentication flow.<p>Here&#x27;s my fork for the omniauth-instagram Ruby gem, which is now allowing me to consistently log in: <a href="https:&#x2F;&#x2F;github.com&#x2F;stefl&#x2F;omniauth-instagram&#x2F;blob&#x2F;master&#x2F;lib&#x2F;omniauth&#x2F;strategies&#x2F;instagram.rb" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;stefl&#x2F;omniauth-instagram&#x2F;blob&#x2F;master&#x2F;lib&#x2F;...</a>
评论 #13233695 未加载
grantmojo超过 8 年前
We started having same issue since last Friday (Dec. 15, 2016) after working fine for months. Same user can login via oauth on one wifi, but not on the other, or even on mobile cellular network. And even when it worked on that wifi at one point, it does not work at other times. We have not found a workaround to fix this, reported to Instagram 24 hours ago, waiting...I tried to login to my account on instagram.com first, then go back to our site, browser would log in automatically. So far, we don&#x27;t have a solution yet.
评论 #13226293 未加载
silencekit超过 8 年前
I reported this to a contact at Instagram and they said they are aware of the issue. They don’t have an ETA for the fix yet, but they are looking into it. It&#x27;s just odd that it seems so random with all of our customers.
评论 #13311008 未加载
评论 #13242970 未加载
krisrak超过 8 年前
I&#x27;m creator of <a href="https:&#x2F;&#x2F;picodash.com" rel="nofollow">https:&#x2F;&#x2F;picodash.com</a>, I noticed the same issue about a week ago but did not get any complains from my customers, so debugged it for 8 hours until I found this (I know it will be hard to believe):<p>I kept getting &quot;Matching code was not found or was already used.&quot; when using thru my oauth python code which btw has been working for 6 years now. But when I used curl to do POST, it worked, when I tried Curl again with same oauth code, it failed, So I think this is something that was recently changed by Instagram, the oauth code only works one time, I kind of remember this code could be used more than once before to make POST call, but there was time limit instead, after which using same code was failing.<p>So with me, this was always failing, but no complains from my customers, I could see logs that new people were signing up.<p>I started testing on localhost, I added debug logs, I did notice that there was 2 POST calls being made, so it was failing. I could see that 2 POST calls was made and first one did work and get access_token, but there was a second call made and this was error 400 and oauth flow was failing. Almost looked like a retry of POST call, cause my code should only make one.<p>I started trying different browsers, failed on all firefox,IE, safari, chrome. And then decided to try on my iphone, it worked 100%, so looked for difference, it was on LTE, so I guessed may be my wifi, switched to wifi on iphone and it started failing 100%. So now on my dev system, I connected modem directly to system without router and tried, it passed 100%, so it was my wireless router (I know weird), I tried another 3rd party instagram web app, had same issue but worked without the wireless router. So on Monday I got another wireless router and no issues, it started working. So this could be an isolated incident for me, I came to conclusion that I was using some old router that was dropping POST request and making second attempt and failing.<p>So I guess if this is affecting all your customer check you code by putting logs that you are making one POST request. Try making a CURL after you receive the code and make sure it is working on first attempt.<p>Today after reading this, I check my oauth login again, I did notice it fail few times, but when I try again, it is passing, so something changed again I think.
评论 #13197082 未加载
评论 #13226324 未加载
sodbileg超过 8 年前
Some of our customers have complained how they were having issues with logging in with their account a few days ago. We&#x27;ve tested it on our end and it was working without any issue. However, we encountered the issue yesterday and still having it. However, a very few customers are not having any issue. Really weird and annoying. Reported to Instagram, still no feedback.
AlexWhite_超过 8 年前
What we know at this moment:<p>1. It not depends on IP of API server behind instagram load balancer 2. It appears on ipv4 and ipv6 both 3. Problem not depends on delay between request code and exchanging this code for token 4. Logout and login helps sometimes
bob6664569超过 8 年前
Has somebody any news regarding this issue ? I&#x27;m facing it too since some days... Quite randomly, seems to depend on device used and&#x2F;or IP ... And maybe the alignment of stars.
chrisan超过 8 年前
Same problem on our end. Some environments work for some users and not for others. Have tried all the StackOverflow suggested answers with no luck.<p>Reported issues but haven&#x27;t heard back
fdim超过 8 年前
I&#x27;ve started having the same issue yesterday as well, noticed few times before but it was happening &#x27;sometimes&#x27;, now it happens all the time. Only workaround is to switch to implicit oauth as @xmrcivicboix suggested
评论 #13226323 未加载
carrja99超过 8 年前
I cannot get ahold of Instagram! This is impacting a lot of our users and there seems to be no channel of communication!
Kn4ppster超过 8 年前
Still not working here (explicit auth). Every attempt is failing with the error 400: Matching code was not found or was already used.
tavosansal超过 8 年前
May I ask if you guys have a link to where you reported this issue? I am having the same problem.
评论 #13187486 未加载
widgetic超过 8 年前
It happens for us as well, it started this week. Lots of users complaining.
phiisland超过 8 年前
In our case, it seems that most of our customer facing this issue is using business profile, any others checked this?
评论 #13211302 未加载
krisrak超过 8 年前
I got reply from Instagram that they are aware of issue and working on it.
评论 #13226287 未加载
turncoat超过 8 年前
Having the same issue since a few days
svens_超过 8 年前
Currently I&#x27;m seeing a lot of 400 errors: &quot;Matching code was not found or was already used.&quot;
评论 #13179424 未加载
评论 #13188315 未加载
评论 #13192710 未加载
sodbileg超过 8 年前
Any response from Instagram?
sandes超过 8 年前
Same problem
oblachniy超过 8 年前
Same problem
edoron超过 8 年前
Same problem here.
dmitryvolinec超过 8 年前
today all work nice!
scrown超过 8 年前
Same problem
评论 #13226321 未加载
frangarcia超过 8 年前
We are having the same issue. Really annoying that it works for some users and for some others doesn&#x27;t. Even same user sometimes works sometimes doesn&#x27;t.
frangarcia超过 8 年前
I have just tried different environments we have with different users that were consistently failing last week (even this morning) and I have been able to get an access token using the server approach. Can anybody else test with their apps if the problem is fixed for you? Fingers crossed.
评论 #13238786 未加载
dekaikiwi超过 8 年前
We&#x27;re experiencing the same issue here. Reports from multiple clients over the last few days. Surely enough checking the logs yields an invalid_credentials error.<p>Trouble is, we can&#x27;t faithfully reproduce the issue from our network, but clients are reporting failures to authenticate every time they try!<p>Have contacted Instagram for an update. Anyone else still experiencing the issue?
评论 #13227741 未加载
jordipolo87超过 8 年前
Anyone know if the problem has already been solved?<p>Thank you!
评论 #13307814 未加载