instagram-basic-display
Local Development and testing on Staging​
To run instagram Basic Display locally you need to:
- open https://developers.facebook.com/
- Sign in using email [email protected] and password from 1Password.
- Click in
My Appsin the navigation bar - The name under
your accountthat you should see in the top right corner isPascal Poochini(for some reason) - Look for
POWR Social=> App Roles => Roles => Instagram Testers => Add your IG account - Open www.instagram.com/accounts/manage_access/ and accept invite.
Now you will be able to sign in.
Same goes for Staging, but look for POWr.io Staging app.
HOW does it work?​
Facebok docs - https://developers.facebook.com/docs/instagram-basic-display-api/getting-started Backend MR with basic api implementation - https://gitlab.com/powr/powr/-/merge_requests/7140 Frontend MR with basic api implementation - https://gitlab.com/powr/powr/-/merge_requests/7098
There are 2 types of inst connection : basic and business. Every social feed element has connectionType attribute. If connectionType is basic it uses basic display api.
After user clicks 'Connect', instagram login modal will be opened.
After user logged in it redirects to ${window.baseUri()}/instagram/basic_oauth/ and sends code and app_id. Using code you can get short_token and then using short_token can get long_token. After getting long_token we save it to db and use to retrieve account posts.
Before closing login window it redirects to instagram_controller.rb#basic_oauth which contains main logic for saving user token to db. Also it opens app/views/instagram/basic_oauth.html.haml and calls window.opener.APP_SETTINGS.loadInstagramFeed to load posts.
If you have any questions you can ask Brent/Nazir.