I have a single page javascript application, and I'm wondering if I can authenticate the user on Instagram without refreshing the page. I'd like to try to do something similar to the Facebook connect using javascript, where a Facebook dialog opens in a popup then calls a callback script after.
Here's what I'm thinking it would do...
- On click, opens a dialog (popup) window where the user logs in to Instagram and the app is granted permission.
- In the popup window, the user is redirected back to my website where my website curls to Instagram to get the access_token, then sets the access token in the user's session or as a cookie.
- Somehow...the main application needs to recognize when the access token has been set. This is the point I'm really not sure about. Would I use a timer to keep making calls back to the server to check for it? Does anyone have any better ideas for detecting it? Would it work better to set it in a cookie?
I thought I'd ask here first before I start coding incase anyone had any ideas as to if this would/wouldn't work, or other suggestions! Maybe this already exists and I'm missing something?
Thanks in advance :-)