I am trying to use the Instagram OAuth using the developer documentation at
https://www.instagram.com/developer/authentication/.
Step 1 and 2 are working without any problems, so I have my Client-ID, the Client-Secret, the Redirect-URI and the code.
But every-time I am trying to get the Acces Token I get the following error:
{
"code": 400,
"error_type": "OAuthException",
"error_message": "Matching code was not found or was already used."
}
Any tips how to solve this?
We are experiencing the same issue. It appears that logging out of Instagram, then attempting to use Instagram OAuth through our site after we are logged out of Instagram is a workaround.
We're experiencing the same issue since yesterday (after months of working fine) - have reported it as an issue yesterday via the 'Report Issue' function on https://www.instagram.com/developer/clients/manage/ and I'd encourage you to do the same.
Yet to hear back, but seems likely it's their end having issues rather than something we're doing.
EDIT: It's also working fine for us on our development servers (which use different IPs for interacting with IG's API) but not working on our production server from any of the IPs we have available on the production server.
EDIT2: (July 2016) Just tested and it's mysteriously started working again on our production servers. No reply to the support ticket from Instagram as yet.
EDIT3: (December 2016) And now it's failing again with the same message... Seems like it's Instagram's end again. Nothing much we can do. Frustrating.
Logging in to Instagram, then complete Step 1 from the API Docs (https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=code), then follow the redirect and copying the code from the URL, then logging out of my account, then completing Step 3:
curl -F 'client_id=CLIENT_ID' \
-F 'client_secret=CLIENT_SECRET' \
-F 'grant_type=authorization_code' \
-F 'redirect_uri=AUTHORIZATION_REDIRECT_URI' \
-F 'code=CODE' \
https://api.instagram.com/oauth/access_token
That worked for me.
We are also experiencing the same issue from yesterday, looks like clearing browser (or new incognito window) do the trick. Although, the mobile app where we are authenticating through mobile browser, working fine.
Update: Deleted all my browsing history, cleared cache, etc. Like it was a brand new browser and now it works with no issue.
I've been hammering on the auth URL for weeks now. Testing and using the same stored token to re-authorize. Maybe stored tokens have a limit to the number of times they can be re-used?
======
Having the same issue as of today. Authorization was working fine earlier - now I'm getting the same 'Matching code...' response.
Signed in and out of my Instagram account repeatedly, created a new app id and disabled/enabled Implicit Oauth - all with no success.
The 'Authorized Applications' view in my Instagram account reports that my application has indeed been authorized, but I can't make calls to the API. Authenticating through an Incognito window returned a successful response but it's not a solution.
Tried reporting to Instagram through their 'Report Issue' form, but it won't allow me to submit the form.
I got the same error message. After 2 hours trying every workaround, I realized that I was using FB secret code instead of IG. Double check it first before trying any other solutions.
SOLVED! Just log out of Instagram and try again. That worked for me.
I solved this by creating a service on the backend/server side that authorised the user.
My backend API is a ruby on rails app. Here is a code snippet to understand.
def token
#response = Instagram.get_access_token(params[:code], redirect_uri: mobile_token_url)
instagram_user = InstagramUserCreator.new(user_params)
if instagram_user.find_or_create
redirect_to "taddarmobileapp://?token=#{instagram_user.user.token}"
else
redirect_to 'taddarmobileapp://'
end
end
I just store the token on the phone and use it to authorise the user to my backend API.
I use Fabric to do Twitter single sign on for my app as well as use TweetUI to display a Twitter Timeline elsewhere in my android app.
Last night while I was messing around with some stuff, somehow both stopped working. I am getting the following errors:
1) For my single sign on flow: E/Twitter﹕ Authorization completed with an error
com.twitter.sdk.android.core.TwitterAuthException: Authorize failed.
2) For my Tweet timeline activity: E/Twitter﹕ Failed to get app auth token
com.packagewriters.mypackage E/TweetUi﹕ 403 Forbidden
com.twitter.sdk.android.core.TwitterApiException: 403 Forbidden
--- This one is weird because Timelines use guest authentication only...so even if I messed up my API keys and what not, this should still work?
I triple checked EVERYTHING and reverted all my changes. I pretty much do everything the Fabric docs tell me to do, not to mention it worked for months before tonight. I'm not sure if I somehow accidentally touched something that messed everything up or if Twitter updated/the authentication servers are down/etc...help please?
Thanks!
Ok so for Single Sign On, i finally fixed it. You have to go to your fabric.io dashboard and get your key/secret and HARD CODE it into your activity/fragment where you integrate Twitter Log in.
This is weird bc Fabric is supposed to do it for you and I've never had to hard code it in before to get it to work. Something fishy is going on here... hopefully it will get fixed soon.
Tweet Timeline works now. Had to open up the Fabric plugin, navigate to the Embed Tweets subsection and let a gradle sync run its course...
I use Oauth via Microsoft and it has worked fine for a while, then a couple of weeks ago (can't remember exactly when) i got some tweet or something from someone saying that they had problems signing in with MS Oauth.
The error i get is this.
https://login.live.com/err.srf?lc=1033#error=invalid_request&error_description=The+provided+value+for+the+input+parameter+'redirect_uri'+is+not+valid.+The+expected+value+is+'https://login.live.com/oauth20_desktop.srf'+or+a+URL+which+matches+the+redirect+URI+registered+for+this+client+application.
The page actually says
"We're unable to complete your request
Microsoft account is experiencing technical problems. Please try again later."
And that indicates that they may actually have some issues but i think it's been like this for a while so i suspect it's just some generic error.
If i look at my request it says.
client_id=[MY CLIENT ID]&scope=wl.basic&response_type=code&redirect_uri=http://dev.ohso.se/login/ExternalLoginCallback/?provider=microsoft&sid=[some id]
I do get the same error on both my dev app and the production app i have setup.
This is how my callback URLs look like. I have tried to add URLS both with ExternalLoginCallback and externallogincallback but it doesn't seems to work. It looks like it's saved but it's gone when you return to the page.
Anyone know how to contat MS to at least report this bug and maybe also get hold of someone that can help debug my problem?
/Ola
OK, got it. The issue is with your request URL, remove / character from ..back/?provid.... Your request URL should be
client_id=[MY CLIENT ID]&scope=wl.basic&response_type=code&redirect_uri=http://dev.ohso.se/login/ExternalLoginCallback?provider=microsoft&sid=[some id]
and you can have any redirect URL #MS
http://dev.ohso.se/login/ExternalLoginCallback
or
http://dev.ohso.se/login/ExternalLoginCallback/
I am working on a Rails application that uses omniauth facebook and linkedin login. It's been working for months, and today we are suddenly having crazy problems logging in / signing up on production (Heroku). I assumed that the problem was on our end, but we have not pushed new code to production in 4 days.
After hours of trial and error, we realized that about half of the time, we are able to login, maybe another 40% of the time we are redirected to the sign in page from linkedin / facebook, and the rest of the time we get an application error with elastic search that I assume results from the insanely long load time. Additionally, when the app renders the login page, in the logs there are "expired token" type errors, which is weird because sometimes it actually works.
I'm assuming that Facebook and Linkedin are not both broken. Does anyone have any feedback on other points of failure that I might look into.
Well, restarting the dyno seems to have fixed the problem.
After I put my domain under Akamai Edge, my previously working Twitter Connect flow stopped working and users get a login error.
Debugging, I found my OAuth call to this url answers "Bad Authentication data".
I tried to look over the net for solutions but it seems I'm the only one with this problem, thanks in advance to everyone who will try to help me.
Just undo the recent changes you've made if the Twitter Client was running smoothly earlier. you must have messed up somewhere!