{ "info": { "author": "Cheesecake Labs", "author_email": "", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 2.1", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "# ckl-rest-auth\nAn opinionated Django app to provide user authentication.\n\n## Installation\n\n1. `pip install cklauth`\n1. Add to your project's `INSTALLED_APPS`:\n - `rest_framework`\n - `rest_framework.authtoken`\n - `corsheaders`\n - `cklauth`\n1. Include `ckl-rest-auth` urls to your project:\n On `urls.py` add `path('', include('cklauth.urls'))`\n1. Add settings according to the project requirements\n - For Django's default user config:\n ```python\n # Field used for authencation together with password (required)\n 'LOGIN_FIELD': 'email',\n\n # Fields used on user serializer\n 'REGISTER_FIELDS': ('username', 'email'),\n\n # From email used on password reset emails (optional)\n 'FROM_EMAIL': 'default@email.com',\n\n # Google authentication settings (optional)\n 'GOOGLE': {\n 'CLIENT_ID': 'insert-your-key',\n 'CLIENT_SECRET': 'insert-your-key',\n 'REDIRECT_URI': 'insert-your-uri',\n },\n\n # Facebook authentication settings (optional)\n 'FACEBOOK': {\n 'CLIENT_ID': 'insert-your-key',\n 'CLIENT_SECRET': 'insert-your-key',\n 'REDIRECT_URI': 'insert-your-uri',\n },\n ``` \n Note that the default `LOGIN_FIELD` is `email` and then you need to use the helper\n authentication backend: \n ```python\n AUTHENTICATION_BACKENDS = ['cklauth.auth.EmailOrUsernameModelBackend']\n ```\n\n - For a custom user model, you can define additional options:\n ```python\n CKL_REST_AUTH = {\n # Field used for authencation together with password (required)\n 'LOGIN_FIELD': 'email',\n\n # Override the default serializer used on registration and authentication responses (optional)\n 'USER_SERIALIZER': 'cklauth.api.v1.serializers.UserSerializer',\n\n # Fields used on user serializer (not used if USER_SERIALIZER is defined above)\n 'REGISTER_FIELDS': ('username', 'email'),\n\n # From email used on password reset emails (optional)\n 'FROM_EMAIL': 'default@email.com',\n\n # Google authentication settings (optional)\n 'GOOGLE': {\n 'CLIENT_ID': 'insert-your-key',\n 'CLIENT_SECRET': 'insert-your-key',\n 'REDIRECT_URI': 'insert-your-uri',\n # Define a callable that receives the social user payload and returns the value on of the\n # User model USERNAME_FIELD (username, for instance). The default function already checks\n # if the value is in use. Set it to `None`, if you don't want to generate a USERNAME_FIELD.\n 'AUTH_FIELD_GENERATOR': 'cklauth.utils.auth_field_generator',\n # How to map the social user payload to the User model fields. It accepts a callable that\n # receives the whole social user payload to map more complex data.\n 'USER_INFO_MAPPING': {\n 'full_name': 'full_name': lambda info: '{} {}'.format(\n info.get('given_name'),\n info.get('family_name')\n ),\n 'email': 'email',\n },\n },\n\n # Facebook authentication settings (optional)\n 'FACEBOOK': {\n 'CLIENT_ID': 'insert-your-key',\n 'CLIENT_SECRET': 'insert-your-key',\n 'REDIRECT_URI': 'insert-your-uri',\n 'AUTH_FIELD_GENERATOR': 'cklauth.utils.auth_field_generator',\n 'USER_INFO_MAPPING': {\n 'full_name': 'full_name': lambda info: '{} {}'.format(\n info.get('first_name'),\n info.get('last_name')\n ),\n 'email': 'email',\n },\n },\n }\n ```\n\n## Basic Endpoints\n\n`POST /api/v1/login` \nBody (depends on LOGIN_FIELD)\n```json\n{\n \"email\": \"example@example.com\",\n \"password\": \"secret\"\n}\n```\nResponse (depends on REGISTER_FIELDS and USER_SERIALIZER) - 200 OK\n```json\n{\n \"token\": \"supersecret\",\n \"user\": {\n \"id\": 1,\n \"email\": \"example@example.com\",\n \"first_name\": \"Example\",\n \"last_name\": \"Example\"\n }\n}\n```\n**Note:** the user payload may vary according to specified REGISTER_FIELDS and USER_SERIALIZER.\n\n`POST /api/v1/register` \nBody (depends on REGISTER_FIELDS and USER_SERIALIZER -- always has a password)\n```json\n{\n \"email\": \"example@example.com\",\n \"password\": \"secret\",\n \"first_name\": \"Example\",\n \"last_name\": \"Example\"\n}\n```\nResponse (depends on REGISTER_FIELDS and USER_SERIALIZER) - 201 CREATED\n```json\n{\n \"token\": \"supersecret\",\n \"user\": {\n \"id\": 1,\n \"email\": \"example@example.com\",\n \"first_name\": \"Example\",\n \"last_name\": \"Example\"\n }\n}\n```\n**Note:** the user payload may vary according to specified REGISTER_FIELDS and USER_SERIALIZER.\n\n`POST /api/v1/password-reset/` \nBody\n```json\n{\n \"email\": \"example@example.com\"\n}\n```\nResponse - 200 OK\n```json\n{\n \"email\": \"example@example.com\"\n}\n```\nNote: it always returns success, even if the provided email is not registered.\n\n\n## Social Endpoints\n\n`GET /api/v1/social/google` \n`GET /api/v1/social/facebook` \n**Note:** this should not be XHR request, the user will be redirected to consent screen. After\nconsent, the user is redirected to platform REDIRECT_URI added on settings, where a code is\nextracted from the URL hash.\n\n`POST /api/v1/social/google` \n`POST /api/v1/social/facebook` \nBody \n```json\n{\n \"code\": \"\",\n \"user_extra_fields\": {\n \"role\": \"admin\"\n }\n}\n``` \n**Note:** You can pass additional user fields in the `user_extra_fields` key, as long as they are\npart of the main `REGISTER_FIELDS` list.\n\nResponse - 200 OK\n```json\n{\n \"token\": \"supersecret\",\n \"user\": {\n \"id\": 1,\n \"email\": \"example@example.com\",\n \"first_name\": \"Example\",\n \"last_name\": \"Example\"\n }\n}\n``` \n**Note:** the user payload may vary according to specified REGISTER_FIELDS and USER_SERIALIZER.\n\n## Contributing\n\nThe library code is under `cklauth` folder and tests are in a test project under `testapp`\nfolder.\n\n### Running tests:\n\n* Ensure that you have the app requirements installed\n```\npip install -r requirements.txt\npip install -e cklauth\n```\n\n* Run the tests\n```\npython -m pytest test_default_user\npython -m pytest test_custom_user\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/CheesecakeLabs/ckl-rest-auth", "keywords": "", "license": "BSD License", "maintainer": "", "maintainer_email": "", "name": "cklauth", "package_url": "https://pypi.org/project/cklauth/", "platform": "", "project_url": "https://pypi.org/project/cklauth/", "project_urls": { "Homepage": "https://github.com/CheesecakeLabs/ckl-rest-auth" }, "release_url": "https://pypi.org/project/cklauth/0.4.0/", "requires_dist": [ "Django (>=2.1)", "djangorestframework (>=3.9)", "django-cors-headers (>=3.0)", "requests (>=2.18)" ], "requires_python": "", "summary": "An opinionated Django app to provide user authentication.", "version": "0.4.0" }, "last_serial": 5393203, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "fc48886390d365a5d7dab04b6cc1822d", "sha256": "3417fe57710101363043552265b8a2729edc2e814032ecf28c6344d9a240da14" }, "downloads": -1, "filename": "cklauth-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "fc48886390d365a5d7dab04b6cc1822d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9869, "upload_time": "2018-04-13T04:37:15", "url": "https://files.pythonhosted.org/packages/21/d4/fc534d747f761050a8ab08d2f166308b38c461df6d9f40eaec8fce6c69ef/cklauth-0.1-py3-none-any.whl" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "8b25ac80e78e48ea1681bdccfd9fb6d5", "sha256": "9b906955aa6aa23c344e8a54f8a30aa8bdd66e72977043d9fc46fc0b307d64fb" }, "downloads": -1, "filename": "cklauth-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "8b25ac80e78e48ea1681bdccfd9fb6d5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10290, "upload_time": "2018-04-13T05:14:22", "url": "https://files.pythonhosted.org/packages/00/30/0af57ea2be1431c2bf697d71ebd62d71e476097b2a4ecd5f9ff8ab24c79f/cklauth-0.1.1-py3-none-any.whl" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "3d92bc9e1a5f32425acdfc04fd955a56", "sha256": "9c0dc10a43a5e5f8324556dc24a65f992b5b61cf5f08bae4941c43af27bc6a42" }, "downloads": -1, "filename": "cklauth-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "3d92bc9e1a5f32425acdfc04fd955a56", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10317, "upload_time": "2018-04-13T18:13:38", "url": "https://files.pythonhosted.org/packages/c0/00/4a0319d376b42e56a40dce435c7f070cebd96eaac30b30c6b0ad2b36b32a/cklauth-0.1.2-py3-none-any.whl" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "607f61dd0f670fe4848aac037e0f54e1", "sha256": "25f83328d15fb4dda50625fbb23eca518a23a04b72f4f99d35f72866d836de58" }, "downloads": -1, "filename": "cklauth-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "607f61dd0f670fe4848aac037e0f54e1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10775, "upload_time": "2018-04-18T13:55:45", "url": "https://files.pythonhosted.org/packages/7d/33/3d538e366221b028ffa4981315a3410e3010be8c3d1841b643da17fc0869/cklauth-0.2.0-py3-none-any.whl" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "629c2872c11c884854e5dd9a97442c32", "sha256": "a9948e02f7f47e65afb59a612bf99c4a70d93fea0ec76b426337f4e4eeef1b44" }, "downloads": -1, "filename": "cklauth-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "629c2872c11c884854e5dd9a97442c32", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10807, "upload_time": "2018-04-26T17:12:19", "url": "https://files.pythonhosted.org/packages/4b/15/6c95e4b29efda505f3e9db61b43bed9a9651258103592c62086fbafc9745/cklauth-0.2.1-py3-none-any.whl" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "88e1ae951a9ec6312294399697ed3e37", "sha256": "24681ab89872a0ef01c94d965beb29fd7701214c1f15980cf77ff263701dc6c7" }, "downloads": -1, "filename": "cklauth-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "88e1ae951a9ec6312294399697ed3e37", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12390, "upload_time": "2018-05-04T17:09:50", "url": "https://files.pythonhosted.org/packages/9d/88/1566342ce391ff5e3070d9d901cd4d79346cdb82c94c5d72042f9320c983/cklauth-0.3.0-py3-none-any.whl" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "e6891c189abce744e0ead4b923b3c225", "sha256": "ae2be1c7bc88e58eabb81b315dca4586d2ee16c193f7f9e23eaa405e6512e863" }, "downloads": -1, "filename": "cklauth-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e6891c189abce744e0ead4b923b3c225", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12036, "upload_time": "2018-10-04T22:00:08", "url": "https://files.pythonhosted.org/packages/c1/73/84a9c61d91e09cf577217cdad13d6ec11603d86a9ee46804f6f98ac1c1a6/cklauth-0.3.1-py3-none-any.whl" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "4b2fc28fc3599b5ebae0791644feb484", "sha256": "e666de23321fb3291daac178b2052a9132c3ff91035c9018f5662892676d1cf7" }, "downloads": -1, "filename": "cklauth-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "4b2fc28fc3599b5ebae0791644feb484", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12050, "upload_time": "2019-06-12T21:24:08", "url": "https://files.pythonhosted.org/packages/4c/09/ee6884c96e180c3acec3058827aebd321e0675125d183a278487281964df/cklauth-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2357b0c05fe34d6931b0670fc95e1b2a", "sha256": "ccb218fb759cdf78e9222f077519a673728bdc16fa4e13488c675d6eaa0d1a7a" }, "downloads": -1, "filename": "cklauth-0.4.0.tar.gz", "has_sig": false, "md5_digest": "2357b0c05fe34d6931b0670fc95e1b2a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10478, "upload_time": "2019-06-12T21:24:10", "url": "https://files.pythonhosted.org/packages/9d/c5/fb886bb118080c5cd45495092508918cb5eaf250b8755d3a052a4af506e9/cklauth-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4b2fc28fc3599b5ebae0791644feb484", "sha256": "e666de23321fb3291daac178b2052a9132c3ff91035c9018f5662892676d1cf7" }, "downloads": -1, "filename": "cklauth-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "4b2fc28fc3599b5ebae0791644feb484", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12050, "upload_time": "2019-06-12T21:24:08", "url": "https://files.pythonhosted.org/packages/4c/09/ee6884c96e180c3acec3058827aebd321e0675125d183a278487281964df/cklauth-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2357b0c05fe34d6931b0670fc95e1b2a", "sha256": "ccb218fb759cdf78e9222f077519a673728bdc16fa4e13488c675d6eaa0d1a7a" }, "downloads": -1, "filename": "cklauth-0.4.0.tar.gz", "has_sig": false, "md5_digest": "2357b0c05fe34d6931b0670fc95e1b2a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10478, "upload_time": "2019-06-12T21:24:10", "url": "https://files.pythonhosted.org/packages/9d/c5/fb886bb118080c5cd45495092508918cb5eaf250b8755d3a052a4af506e9/cklauth-0.4.0.tar.gz" } ] }