Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instagram API prevents redirection to iOS app upon successful login with 400 bad request error

I'm trying to integrate Instagram login into my app to get the logged in user's details, I've registered my app on Instagram and got my client ID, then I added a new URL Type in the project settings with the identifier: igxxxx (where xxxx is my client id), i've also set the redirect URI to be (xxxx://authorize), once I successfully log in (using a webView) Instagram displays a white blank page with (400 Bad Request) text written on top, however, when I change the redirect URI to anything else, it opens without problems after a successful login.
how can I redirect the user to the app after he logs in with Instagram.

p.s. I use this library to ease up things.

thanks in advance.

like image 236
JAHelia Avatar asked Jun 18 '16 14:06

JAHelia


1 Answers

Here's what I have found so far. I have been able to resolve the issue to get the app to work on the iPhone. However, this solution doesn't allow me to submit the app on the app store as you will read ahead. I have submitted a bug with instagram, not sure how long they will take.

I would suggest everyone go to this link and "Report Issue":

https://www.instagram.com/developer/clients/manage/

I have had an app in app store for couple months without problems. However, since June 19, all the users trying to authenticate get a white page with "400 Bad Request" after they login with their IG account.

The issue is very common as you will see on this stack overflow page:

Instagram API prevents redirection to iOS app upon successful login with 400 bad request error

And google shows the same issue with many users since June 19.

I have figured out that the old redirect URI which we were using:

myappname://

is the issue.

If we change this redirect URI to:

http://myappname

or

https://myappname

This all starts working fine and we get the access token.

However as per RFC1738, this is not a valid format for URL schemes which is used in iOS development.

So we get error when submitting our apps to app store:

ERROR ITMS-90158: "The following URL schemes found in your app are not in the correct format: [https: //myappname]. URL schemes need to begin with an alphabetic character, and be comprised of alphanumeric characters, the period, the hyphen or the plus sign only. Please see RFC1738 for more detail."
ERROR ITMS-90158: "The following URL schemes found in your app are not in the correct format: [https: //myappname]. URL schemes need to begin with an alphabetic character, and be comprised of alphanumeric characters, the period, the hyphen or the plus sign only. Please see RFC1738 for more detail."

So we can't submit to app store with this solution.

So unless instagram does something to fix this back to how it used to be, we are stuck :(

like image 53
sudoExclaimationExclaimation Avatar answered Nov 02 '22 22:11

sudoExclaimationExclaimation