Closed isjackwild closed 4 years ago
Just had a thought... could this be achieved simply by storing the long access token in a craftagram specific config table in the database (an approach used by some other plugins I've seen), rather than being stored in the project config?
I cannot add localhost to the App OAuth redirects, as it doesn't allow any non-HTTPS URI's
Is this an instagram restriction or a restriction in our plugin? I don't think we have put in any checks on whether the redirect_uri
needs to be HTTP or HTTPS, but I could be wrong.
I agree regarding storing the token in the database. I hadn't considered project configs would get out of sync!
The non-HTTPS thing is an instagram restriction. It could probably be worked around using ngrok now I think of it, although might not need to if you just don't bother setting it up on production / staging environments.
The project syncing thing is something I've come across with a couple of other plugins also, it's an awesome feature usually, but sometimes plugin settings can end up overwriting themselves, as everything will be synced with your development project.yml. Another thing to consider though is how to connect / install the instagram on production environments which may have allowAdminChanges: false — as you can't access or update settings section or plugins if this is set. Some other plugins I've seen have a work around where they add in a new item to the main craft menu (left hand sidebar) where you can do the instagram authorisation action.
Having the same problem with the multi environment. Another additional thing, it would be cool to store the app keys in .env variables so they don't end up in git history.
@isjackwild 1.2.0 is available and will store the long-access token in the database. It also has a CP section available.
Hey @joshua-martin thanks for the updates! Only one thing small thing: when using the authorize button with allowAdminChanges = false, it still redirects to the settings page which is showing the "Administrative changes are disallowed in this environment." :smile: It saves perfectly, only the redirect goes wrong.
Hey 👋
I've just found your plugin and set it up and it's exactly what I've been looking for! However, I'm running into issues with syncing between environments, using the Craft Project Config file.
Currently I have a local dev environment, a staging environment, and a production environment. These are synced using the Craft Project Config file.
The issue I'm having is: a) I cannot add localhost to the App OAuth redirects, as it doesn't allow any non-HTTPS URI's b) If I authorise Craftagram on Staging or Production, it all works fine, but when I then sync again, the long access token gets removed c) If I were to set up a cron job to renew the access token on production, as outlined in the docs, this would presumably cause the project config on production to be different from other environments, and would also be overwritten the next time Craft was synced.
I was wondering if this is something which has been considered and if there's a work-around for, as unfortunately if it's not compatible it will mean I'm not able to use the Plugin. It's always such a pain working with the Instagram API, why do they make it so hard! 😂