{"id":21151632,"url":"https://github.com/alina1412/try_oauth_educational","last_synced_at":"2025-07-17T18:31:36.799Z","repository":{"id":138252243,"uuid":"564823877","full_name":"alina1412/try_oauth_educational","owner":"alina1412","description":"Educational FastApi project for checking usage of jwt tokens","archived":false,"fork":false,"pushed_at":"2025-01-26T08:00:38.000Z","size":231,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-14T14:28:40.269Z","etag":null,"topics":["fastapi","makefile","poetry","pytest"],"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/alina1412.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}},"created_at":"2022-11-11T15:28:30.000Z","updated_at":"2025-01-26T08:00:42.000Z","dependencies_parsed_at":"2023-04-09T05:01:01.705Z","dependency_job_id":null,"html_url":"https://github.com/alina1412/try_oauth_educational","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alina1412/try_oauth_educational","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alina1412%2Ftry_oauth_educational","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alina1412%2Ftry_oauth_educational/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alina1412%2Ftry_oauth_educational/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alina1412%2Ftry_oauth_educational/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alina1412","download_url":"https://codeload.github.com/alina1412/try_oauth_educational/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alina1412%2Ftry_oauth_educational/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265645373,"owners_count":23804183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["fastapi","makefile","poetry","pytest"],"created_at":"2024-11-20T10:17:58.917Z","updated_at":"2025-07-17T18:31:36.777Z","avatar_url":"https://github.com/alina1412.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"#### Educational FastApi project \nfor checking usage of jwt tokens and encode(), decode() methods from jose library.\n\nThe project has \"fake\" database, passwords are used just for checking the technology.\n\n### Tools used:\n- poetry\n- Makefile\n- pytest\n\n### Stack:\n- FastAPI\n- swagger\n\n### Swagger\n- \"Authorize\" button allows to check auth in headers\n\u003cimg src=\"https://github.com/user-attachments/assets/cbb4a840-2ec3-4999-b97c-94a03152d992\" width=\"50%\"\u003e\n\u003cimg src=\"https://github.com/user-attachments/assets/bbd9bcd0-db5b-4692-8ca6-f77fa4bc25b4\" width=\"50%\"\u003e\n\n\n\n### Topics to study:\n- Dependencies `from fastapi import Depends`\n- Creating tokens `token = jwt.encode(claims=data_to_encode, key=key)`\n- Passsing tokens through headers `token = request.headers.get(\"client_secret\")`\n- Passing headers in pytest ```response = client.post(url + f\"?username={username}\u0026password={password}\", \n        headers={\"Authorization\": \"bearer xxx\", \"client_secret\": token})```\n- Usage of password hashing ```from passlib.context import CryptContext ...\nhasher = CryptContext(schemes=[\"sha256_crypt\", \"md5_crypt\", \"des_crypt\"])\n...hasher.verify(\"my-password\", hashed_password_from_db)```\n- Passing headers by curl \n```\n\nexample of a request \n\ncurl -X 'POST' \\\n  'http://0.0.0.0:8000/v1/?username=joe\u0026password=123' \\\n  -H 'accept: application/json' \\\n  -d '' -H 'Authorization:bearer xxx' \\\n  -H 'client_secret:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImpvZSIsImV4cGlyZSI6IjIwMjUtMDEtMjRUMTQ6Mjg6MDMuMDM2NzI0KzAwOjAwIn0.GTphQVoUy6eBX14hx2UPXv6-4u4tbrgUEWLEHXGLFho'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falina1412%2Ftry_oauth_educational","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falina1412%2Ftry_oauth_educational","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falina1412%2Ftry_oauth_educational/lists"}