{"id":41369714,"url":"https://github.com/iliadmitriev/auth","last_synced_at":"2026-01-23T09:10:07.741Z","repository":{"id":38759519,"uuid":"339989324","full_name":"iliadmitriev/auth","owner":"iliadmitriev","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-16T02:45:08.000Z","size":769,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-16T16:26:23.948Z","etag":null,"topics":["django","docker","i18n","l10n","pip","python","restframework","restframework-simple-jwt","simplejwt","unittests","uwsgi"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iliadmitriev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-02-18T08:52:41.000Z","updated_at":"2026-01-16T02:45:05.000Z","dependencies_parsed_at":"2023-02-18T05:46:13.068Z","dependency_job_id":"df0bc3cc-53ab-46f0-b5dd-0b10ab2deeac","html_url":"https://github.com/iliadmitriev/auth","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/iliadmitriev/auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iliadmitriev%2Fauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iliadmitriev%2Fauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iliadmitriev%2Fauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iliadmitriev%2Fauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iliadmitriev","download_url":"https://codeload.github.com/iliadmitriev/auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iliadmitriev%2Fauth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28685709,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","docker","i18n","l10n","pip","python","restframework","restframework-simple-jwt","simplejwt","unittests","uwsgi"],"created_at":"2026-01-23T09:10:06.929Z","updated_at":"2026-01-23T09:10:07.736Z","avatar_url":"https://github.com/iliadmitriev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auth\n\n![CI tests](https://github.com/iliadmitriev/auth/actions/workflows/python-app.yml/badge.svg?branch=master)\n[![codecov](https://codecov.io/gh/iliadmitriev/auth/branch/master/graph/badge.svg?token=5J4G4NH0XA)](https://codecov.io/gh/iliadmitriev/auth)\n\nJWT auth service built using Django, Simple JWT, DRF\n\nMinimal Python version `3.10`\n\n# install\n\n1. install python3 and create virtual env\n```shell\npython3 -m venv venv\nsource venv/bin/activate\n```\n2. install requirements\n```shell\npip install -r requirements.txt\n```\n3. put django secret key into file .env\ngenerate DJANGO_SECRET_KEY\n```shell\necho DJANGO_SECRET_KEY=\\'$(python3 -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())')\\'  \u003e\u003e .env\n```\nor just create test secret key (don't do this in production)\n```shell\necho DJANGO_SECRET_KEY=testsecretkey  \u003e\u003e .env\n```\n\n4. export variables from .env file\n```shell\nexport $(cat .env | xargs)\n```\n5. create services postgres and memcached\n```shell\ndocker run -d --name auth-postgres --hostname auth-postgres \\\n    -p 5432:5432 --env-file .env postgres:14-alpine\n    \ndocker run -d -p 11211:11211 --name auth-memcached memcached:alpine\n```\n6. create a db (run migrations)\n```shell\npython3 manage.py migrate\n```\n7. compile messages\n```shell\npython3 manage.py compilemessages\n```\n8. create superuser\n```shell\npython3 manage.py createsuperuser\n```\n\n# development\n\n---\n1. set environment variables\n```shell\nDJANGO_DEBUG=True\n```\n\n2. make migrations and migrate\n```shell\npython3 manage.py makemigrations\npython3 manage.py migrate\n```\n\n3. make messages\n```shell\npython3 manage.py makemessages -a\npython3 manage.py compilemessages\n```\n\n4. run\n```shell\npython3 manage.py runserver 0:8000\n```\n\n# testing\n\n## run tests \n\n1. run all tests\n```shell\npython3 manage.py test\n```\n2. run with keeping db in case of test fails\n```shell\npython3 manage.py test --keepdb\n```\n3. run all tests with details\n```shell\npython3 manage.py test --verbosity=2\n```\n⚠️ parallel test running doesn't work under Windows and macOS\n\n## run tests with coverage\n\n1. install coverage\n```shell\npip install coverage\n```\n2. run with coverage\n```shell\ncoverage run --source='.' manage.py test\n```\n3. print report with missing lines\n```shell\ncoverage report -m\n```\n4. generate detailed html report\n```shell\ncoverage html\nopen htmlcov/index.html\n```\n⚠️ coverage doesn't work when running test parallel under Windows and macOS\n\n\n# how to use\n\n1. register new account\n```shell\ncurl -v -H 'Accept: application/json; indent=4' \\\n  -H 'Content-Type: application/json' \\\n  -d '\n    {\n        \"email\": \"youremailbox@example.com\",\n        \"password\": \"yourpassword\",\n        \"password2\": \"yourpassword\"\n    }' \\\n    http://localhost:8000/auth/register/\n```\n2. get auth token\n```shell\ncurl -v -H 'Accept: application/json; indent=4' \\\n  -H 'Content-Type: application/json' \\\n  -d '\n    {\n        \"username\": \"youremailbox@example.com\",\n        \"password\": \"yourpassword\"\n    }' \\\n    http://localhost:8000/auth/token/\n```\n3. get restricted data using auth tocken\n```shell\ncurl -v -H 'Accept: application/json; indent=4' \\\n  -H 'Authorization: Bearer youraccessotoken' \\\n  http://localhost:8000/auth/user/\n```\n4. refresh token\n```shell\ncurl -v -H 'Accept: application/json; indent=4' \\\n  -H 'Content-Type: application/json' \\\n  -d '\n  {\n    \"refresh\": \"your refresh token goes here\"\n  }' \\\n  http://localhost:8000/auth/token/refresh/\n```\n⚠️ by default token is expiring in 5 minutes, after that you will get message `Token is invalid or expired` with `403 Forbidden` http code\n\n\n# production\n\n---\n\n## prepare\n\n1. migrate migrations\n```shell\npython3 manage.py migrate --noinput\n```\n2. collect static\n```shell\npython3 manage.py collectstatic --noinput\n```\n\n3. compile messages\n```shell\npython3 manage.py compilemessages\n```\n\n## Web server\n\n### uWSGI\n\n1. install uWSGI\n```shell\npip install uWSGI\n```\n\n2. Run\n```shell\nuwsgi --ini uwsgi.ini\n```\n\n## Docker\n\n### Build image\n\n1. create .env file with environment variables\n```shell\nDJANGO_SECRET_KEY=testsecretkey\nPOSTGRES_HOST=192.168.10.1\nPOSTGRES_PORT=5432\nPOSTGRES_DB=auth\nPOSTGRES_USER=auth\nPOSTGRES_PASSWORD=authsecret\nMEMCACHED_LOCATION=192.168.10.1:11211\n```\n2. build docker image\n```shell\ndocker build -t auth ./\n```\n3. create postgres instance\n```shell\ndocker run -d -p 5432:5432 --name auth-postgres --env-file .env postgres:13.2-alpine\n```\n4. create memcached instance\n```shell\ndocker run -d -p 11211:11211 --name auth-memcached --env-file .env memcached:alpine\n```\n5. create auth instance\n```shell\ndocker run -d -p 8000:8000 --name auth-api --env-file .env auth\n```\n6. run migrations\n```shell\ndocker exec -ti auth-api python3 manage.py migrate\n```\n7. create super user\n```shell\ndocker exec -ti auth-api python3 manage.py createsuperuser\n```\n\n\n## docker-compose run\n\n1. create .env file with environment variables\n```shell\nDJANGO_SECRET_KEY=testsecretkey\nPOSTGRES_HOST=192.168.10.1\nPOSTGRES_PORT=5432\nPOSTGRES_DB=auth\nPOSTGRES_USER=auth\nPOSTGRES_PASSWORD=authsecret\nMEMCACHED_LOCATION=192.168.10.1:11211\n```\n2. run services\ninteractively with logs\n```shell\ndocker-compose up\n```\nor run services as daemons\n```shell\ndocker-compose up -d\n```\n3. migrate\n```shell\ndocker-compose exec api python3 manage.py migrate\n```\n4. create super user\n```shell\ndocker-compose exec api python3 manage.py createsuperuser\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filiadmitriev%2Fauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filiadmitriev%2Fauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filiadmitriev%2Fauth/lists"}