-
Notifications
You must be signed in to change notification settings - Fork 86
Description
Hi,
I've set up an Instagram app/client and Valid redirect URIs for my instagram app is like the following:
http://127.0.0.1.xip.io:3000/dashboard/omni/auth/instagram/callback
I've started to get Redirect URI doesn't match original redirect URI error.
Here is the backtrace:
I, [2015-11-27T13:34:10.883170 #10189] INFO -- omniauth: (instagram) Callback phase initiated.
[httplog] Connecting: api.instagram.com:443
[httplog] Sending: POST http://api.instagram.com:443/oauth/access_token
[httplog] Data: client_id=11111&client_secret=22222&code=XXXXX&grant_type=authorization_code&redirect_uri=http://127.0.0.1.xip.io:3000/dashboard/omni/auth/instagram/callback?code=XXXXX&state=33333
[httplog] Status: 400
[httplog] Benchmark: 0.20239810000020952 seconds
[httplog] Response:
{"code": 400, "error_type": "OAuthException", "error_message": "Redirect URI doesn't match original redirect URI"}
E, [2015-11-27T13:34:11.487103 #10189] ERROR -- omniauth: (instagram) Authentication failure! invalid_credentials: OAuth2::Error, :
{"code": 400, "error_type": "OAuthException", "error_message": "Redirect URI doesn't match original redirect URI"}
After digging around, I've noticed that if I remove query string from redirect_uri which is ?code=XXXXX&state=33333, it works like a charm. However, according to Instagram API Documentation(http://instagram.com/developer/authentication/) it is possible to use query parameters.
In order to remove query string from redirect_uri, I had to add the following method to omniauth-instagram-1.0.1/lib/omniauth/strategies/instagram.rb file:
def query_string
''
endBut, I'm not sure if this is the best solution. Is this a bug or is there a problem with my settings? This gem used to work before.
Thanks.
-Ozgun.