I am writing a PHP app to fetch all my photos with Instagram using their API. However, what puzzles me is, I run the app on my hosted server it works perfectly fine and the same app running locally does not work.
Here are some points on the app workflow:
- The user sees the homepage and he will be prompted with 'sign-in with Instagram'
- User signs in with Instagram and authorizes the app.
- Instagram redirects the user.
- The app then makes a request for access_token and receives it.
- Using the access_token, the app will send further requests for user media
- The response is parsed and the links to the images are now provided to the user.
All the above mentioned process works fine on my hosted server but fails at 'Step 3.' and redirects user to home page of my app.
The problem is localhost being the redirect_uri. Does anyone have a solution to this problem to use the app locally?
P.S: I have registered two separate clients on Instagram: one for locally hosted development and the other on a web server.
Also, I have tried localtunnel. Did not help either.