Case
Posts: 0
Joined: Mon Mar 10, 2014 12:08 am

Instagram 'code' returns empty when using Instagram api plugin

Hey guys, added and followed along with this tutorial:
http://blog.appery.io/2013/04/get-acc...

Instagram login and authentication works and redirects back to app, but the URL code fragment is not parsed and/or stored into localStorage.

Checked in Chrome debugger but the localStorage variable returns with an empty string and so no Instagram token is created, stored or can be used for the rest of the services.

The plugins 'Instagram_Login' JavaScript url parsing script seems to be the culprit. Perhaps (like facebook) the order of the url response has changed recently and broken this code? I'm fumbling through but so far not sure where the breakdown is. Hoping you can help.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Instagram 'code' returns empty when using Instagram api plugin

Hello!

1) Plugin is outdated, it won't work on device.Instead window.plugins.childBrowser you have to use InAppBrowser (here is more information http://cordova.apache.org/docs/en/3.0... and here is example https://getsatisfaction.com/apperyio/...

2) Please check if you have correct service parameters. With your data try to navigate to https://instagram.com/oauth/authorize/ page

3) Check settings in http://instagram.com/developer/

4) If all settings are correct, show URL value in alert. in Instagram_Login file in the beginning of parseUrl method add prealert(window.location.href);/pre

Case
Posts: 0
Joined: Mon Mar 10, 2014 12:08 am

Instagram 'code' returns empty when using Instagram api plugin

Hi Maryna, I still have to wrap my head around the InAppBrowser issue as I'm using the existing tutorial code and am not certain as to what sections to update in order to switch from childBrowser to InAppBrowser.

As for the service parameters, they are being sent fine and the return url (using childBrowser) has the code in it. I can see the full url being parsed to remove #'s as: http://appery.io/app/view/myappidnumb...

However the code just gets saved to localStorage as an empty string.

I see this line in the instagram_login script:
codeelse {
localStorage.setItem('code', '');
window.top.location = _this.parseRedirectURl(authUrl);
}/code

this is what seems to happen, it just stores an empty string. I really need the code from the URL stored so I can use it in the other services.

Then I guess I'll have to figure out the InAppBrowser stuff.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Instagram 'code' returns empty when using Instagram api plugin

Hello!

1) Do you test on device? It won't work without inAppBrowser, but should work on preview.
2) You don't need code localStorage variable. Add to getAccessToken method in the beginning of function the following code prealert(code);/preThis way you'll be able to see what code is passed to service of token retrieving.
3) Check in developers console what data is sent by service and what you have in response.

Return to “Issues”