Used:
-
Download and upload to your server or clone the repository.
-
composer install
-
Open ".env" file and set DB connection parameters in
DATABASE_URL=mysql://db_user:[email protected]:3306/db_name
-
Clear cache:
php bin/console cache:clear
-
Configure a Web Server:
https://symfony.com/doc/current/setup/web_server_configuration.html -
Create users table in DB:
bin/console doctrine:schema:create
Create an administrator with the email "[email protected]" and the password "admin" (you can change it later):
php bin/console doctrine:fixtures:load --append --group=UserFixtures
-
Generate JWT keys in folder "config/jwt":
jwt_passhrase=$(grep ''^JWT_PASSPHRASE='' .env | cut -f 2 -d ''='') echo "$jwt_passhrase" | openssl genpkey -out config/jwt/private.pem -pass stdin -aes256 -algorithm rsa -pkeyopt rsa_keygen_bits:4096 echo "$jwt_passhrase" | openssl pkey -in config/jwt/private.pem -passin stdin -out config/jwt/public.pem -pubout setfacl -R -m u:www-data:rX -m u:"$(whoami)":rwX config/jwt setfacl -dR -m u:www-data:rX -m u:"$(whoami)":rwX config/jwt
-
Get token:
curl -X POST -H "Content-Type: application/json" http://localhost:8000/authentication_token -d '{"email":"[email protected]","password":"admin"}'
Token usage on API page. Click "Authorize" button. Paste string with token:
Bearer MY_TOKEN