{"id":16747507,"url":"https://github.com/hzlmn/aiohttp-jwt","last_synced_at":"2025-04-04T07:08:50.589Z","repository":{"id":37957695,"uuid":"103176717","full_name":"hzlmn/aiohttp-jwt","owner":"hzlmn","description":"aiohttp middleware and helper utils for working with JSON web token.","archived":false,"fork":false,"pushed_at":"2024-10-14T16:29:21.000Z","size":210,"stargazers_count":76,"open_issues_count":17,"forks_count":15,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-20T07:46:36.184Z","etag":null,"topics":["aiohttp","asyncio","jwt","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hzlmn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2017-09-11T19:07:10.000Z","updated_at":"2024-08-18T18:48:52.000Z","dependencies_parsed_at":"2023-10-02T21:03:27.524Z","dependency_job_id":"8410fb20-5900-42a2-ac61-10ee3ef62aa0","html_url":"https://github.com/hzlmn/aiohttp-jwt","commit_stats":{"total_commits":92,"total_committers":10,"mean_commits":9.2,"dds":0.4130434782608695,"last_synced_commit":"914d062c00ad443d7d4d3e62c0b72184055072a2"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hzlmn%2Faiohttp-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hzlmn%2Faiohttp-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hzlmn%2Faiohttp-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hzlmn%2Faiohttp-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hzlmn","download_url":"https://codeload.github.com/hzlmn/aiohttp-jwt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247135144,"owners_count":20889421,"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":["aiohttp","asyncio","jwt","python"],"created_at":"2024-10-13T02:10:13.389Z","updated_at":"2025-04-04T07:08:50.509Z","avatar_url":"https://github.com/hzlmn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## aiohttp-jwt \n[![Downloads](https://pepy.tech/badge/aiohttp-jwt/month)](https://pepy.tech/project/aiohttp-jwt/month)\n[![Build Status](https://travis-ci.org/hzlmn/aiohttp-jwt.svg?branch=master)](https://travis-ci.org/hzlmn/aiohttp-jwt)\n[![codecov](https://codecov.io/gh/hzlmn/aiohttp-jwt/branch/master/graph/badge.svg)](https://codecov.io/gh/hzlmn/aiohttp-jwt)\n\nThe library provides `aiohttp` middleware and helper utils for working with JSON web tokens.\n\n  * Works on Python3.5+\n  * MIT License\n  * Latest docs [TBD]()\n  * Contributions are highly welcome!\n\n\n## Requirements\n - [Aiohttp \u003e= 2.3.5](https://github.com/aio-libs/aiohttp)\n - [PyJWT](https://github.com/jpadilla/pyjwt)\n\n\n## Install\n```bash\n$ pip install aiohttp_jwt\n```\n\n## Simple Usage\n`server.py`\n```python\nimport jwt\nfrom aiohttp import web\n\nfrom aiohttp_jwt import JWTMiddleware\n\nsharable_secret = 'secret'\n\n\nasync def protected_handler(request):\n    return web.json_response({'user': request['payload']})\n\n\napp = web.Application(\n    middlewares=[\n        JWTMiddleware(sharable_secret),\n    ]\n)\n\napp.router.add_get('/protected', protected_handler)\n\nif __name__ == '__main__':\n    web.run_app(app)\n\n```\n\n`client.py`\n```python\nimport asyncio\n\nimport aiohttp\nimport async_timeout\n\n\nasync def fetch(session, url, headers=None):\n    async with async_timeout.timeout(10):\n        async with session.get(url, headers=headers) as response:\n            return await response.json()\n\n\nasync def main():\n    async with aiohttp.ClientSession() as session:\n        response = await fetch(\n            session,\n            'http://localhost:8080/protected',\n            headers={'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InRlc3QifQ.pyNsXX_vNsUvdt6xu13F1Gs1zGELT4Va8a38eG5svBA'})\n        print(response)\n\nloop = asyncio.get_event_loop()\nloop.run_until_complete(main())\n\n```\n\n## Examples\n- [Basic Example](/example/basic.py)\n- [Permissions control](/example/permissions.py)\n\n\n\n## Credits\n\nThis module inspired by official [auth0/express-jwt](https://github.com/auth0/express-jwt) middleware and\n[express-jwt-permissions](https://github.com/MichielDeMey/express-jwt-permissions) extension.\n\n\n## Related packages\n  For advanced security facilities check [aio-libs/aiohttp_security](https://github.com/aio-libs/aiohttp-security)\n\n### License\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhzlmn%2Faiohttp-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhzlmn%2Faiohttp-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhzlmn%2Faiohttp-jwt/lists"}