Provides user registration, e-mail activation, stateless authentication using signed tokens similar to JWT.
php: ^7.3, mongodb pecl extension, composer
docker-compose exec php php -dopcache.enable=0 ./vendor/bin/phpunit --do-not-cache-resultNext steps suggest current ./docker directory.
cd docker
docker-compose -f docker-compose.build.yml up -d- Mongo (database),
- Mailhog (mail catcher available on http://localhost:8025/)
- PHP dev server
docker-compose up -dWait until mongo schema is ready (mongo is not ready immediately after container start):
docker-compose exec php php artisan odm:schema:createuser1, user2, user3
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'email=user1@localhost&password=123' http://127.0.0.1:8000/register
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'email=user2@localhost&password=123' http://127.0.0.1:8000/register
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'email=user3@localhost&password=123' http://127.0.0.1:8000/registerdocker-compose exec php php artisan mail-queue:spooldocker-compose exec php php artisan mail-queue:sendOpen mailhog http://localhost:8025/ and navigate by activation link, response should be:
{"messages":["Activated."]}Auth request
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'email=user3@localhost&password=123' http://127.0.0.1:8000/authshould return token (contains from payload and signature joined with "~") like this:
eyJlbWFpbCI6InVzZXIzQGxvY2FsaG9zdCIsImV4cCI6MTU4MDY5MzYyOH0~COSoh79OWEMl5yUnY6To7rVGTvyHUMh-1oVPdPiJXY4
curl http://localhost:8000/verify/%already_generated_token%
response: {"messages":["Token is valid."]}
docker-compose exec php php artisan auth:purge