maaarghk / magento-jwt-refresh-service

Add an API service for refreshing Magento JWTs
https://packagist.org/packages/maaarghk/magento-jwt-refresh-service
2 stars 0 forks source link

Installation instructions #1

Open itnavigate opened 5 months ago

itnavigate commented 5 months ago

As a new Magento developer, I'm not sure how to install this.

I am proficient with *NIX CLI and Docker (where I'm currently running my Magento 2 instance).

I guess that I need to clone this repo into a directory in the ..../magento tree somwhere, but where please?

maaarghk commented 5 months ago

Hi, it is sufficient to just:

composer require maaarghk/magento-jwt-refresh-service

In general you'll have a better time if you never add extension author's code to your magento/app directory, try to always manage it with composer. Some of the paid extensions make you jump through hoops for this but it's worth it to not check in code that is not yours to version control / upgrade just by updating your composer config.

BTW: I haven't tested this on the latest version of Magento - the site I run it on is currently on 2.4.6-p3

maaarghk commented 5 months ago

repo.magento.com shouldn't really come into it - could just be bad timing and a blip at the webserver on their end.

As off-topic advice (which I don't think is relevant to the error message) you can (and in my opinion should when you're using docker) put auth.json in the same directory as composer.json, and run composer as the magento user. Not sure about your docker workflow - but, if you're bind mounting a local directory owned by your local user, then it's just annoying to suddenly have files owned by root in your vendor directory, not to mention it may actually stop the php-fpm process being able to read them if the vendored files have 640 permissions and the daemon drops privileges to the magento user. As well as that, having the auth.json saved to /root/.composer or whatever will only last as long as the container, and it is likely that the container gets destroyed and recreated when you do things like change environment variables. Having it in the magento root directory means you won't get prompted to re-enter your repo.magento.com authentication credentials every time this happens.

itnavigate commented 5 months ago

Hmm.... I deleted my error message post(before I saw that you had replied), as it self resolved, so your comment appears to be correct. Thanks for the auth.json tip. I am indeed bind mounting a local directory, and it certainly causes issues. after my recent "run as root" incident, I need to rebuild the instance to get the permission back correct and php-fpm running properly. But this is why I Docker :-) If you have a copy of my deleted error message in your email, please feel free to put it back in here for posterity. I don'tmhave a copy of it.

itnavigate commented 5 months ago

I can report that this works with version 2.4.7