{ "info": { "author": "Felipe Cavalcanti", "author_email": "fjfcavalcanti@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3" ], "description": "django-google-auth\n==================\n\nA google auth authenticator backend for django and django rest framework.\nThis backend will validate the user's access token against google in every request, so that when a user has it's email removed from the domain for example, it will lose access instantly.\n\n### Installation\n```\npip install django-google-auth\n```\n\nAdd google_auth to your INSTALLED_APPS\n```\nINSTALLED_APPS = (\n ...\n 'google_auth',\n)\n```\n\nInclude auth urls to your urls.py\n```\nurlpatterns = patterns(\n ...\n (r'^google_auth/', include('google_auth.urls')),\n)\n```\n\nInclude google_auth.authentication.GoogleAuthBackend to AUTHENTICATION_BACKENDS\n```\nAUTHENTICATION_BACKENDS = (\n ...\n \"google_auth.authentication.GoogleAuthBackend\",\n)\n```\n\n### Settings\nThe settings of this app are:\n- GOOGLE_AUTH_CLIENT_ID\nthe client id of your google app\n- GOOGLE_AUTH_CLIENT_SECRET\nthe client secret of your google app\n- GOOGLE_AUTH_AUTHORIZED_DOMAINS\nthe email domains that are authorized to use your app (defaults to gmail.com)\n- GOOGLE_AUTH_SCOPE\nthe scope of the authorization (defaults to \"email profile\")\n- GOOGLE_AUTH_REDIRECT_URL\nthe redirect url after google authorization, must change it to some endpoint that contains some business logic of yours (defaults to \"localhost:8000\")\n\nall of them must be set.\n\n### Flow to authenticate\ne.g. (assuming that urls are mounted as in the example above)\n```\n$ curl localhost:8000/auth/code_url\nhttps://accounts.google.com/o/oauth2/v2/auth?client_id=xxxx&redirect_uri=http%3A%2F%2Fwww.127.0.0.1.xip.io%3A8000%2Fauth%2Fcomplete%2F&scope=email+profile&access_type=offline&response_type=code\n```\nUser access the url from a browser and complete the login @ google, GOOGLE_AUTH_REDIRECT_URL will be called, containing the code:\ne.g.\n```\nGOOGLE_AUTH_REDIRECT_URL/?code=xxxxxxxxx#\n```\nCode should then be exchanged by an app token (this will also create a Django User and register google auth and refresh token in the database for further use authenticating every request against google)\n```\ncurl -X POST \"localhost:5000/google_auth/authenticate/?code=xxxxxxxxx\"\n{\"token\": \"xxxxxxxxx-xxxxxxxxxxxxxx-xxxxxxxxxxxxxxx\", \"email\": \"me@felipejfc.com\"}\n```\n\n### Authenticating requests\nAfter completing the above flow, to authenticate an user's request, set an Authorization header\n```\nAuthorization: token xxxxxxxxxx-xxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxx\n```\n\n##### Rest Framework\nFor django rest framework, add google_auth.authentication.GoogleAuthAuthentication to REST_FRAMEWORK.DEFAULT_AUTHENTICATOR_CLASSES\n```\n 'DEFAULT_AUTHENTICATION_CLASSES': (\n ...\n google_auth.authentication.GoogleAuthAuthentication,\n ),\n```\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/felipejfc/django-google-auth", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-google-auth", "package_url": "https://pypi.org/project/django-google-auth/", "platform": "", "project_url": "https://pypi.org/project/django-google-auth/", "project_urls": { "Homepage": "https://github.com/felipejfc/django-google-auth" }, "release_url": "https://pypi.org/project/django-google-auth/0.4.0/", "requires_dist": null, "requires_python": "", "summary": "google-auth support for django", "version": "0.4.0" }, "last_serial": 3191924, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "13dad556c6a89b029abf661ccb02c289", "sha256": "ed03d58c223a11f3c570624f478dff46e86caa1bf3fce62735ea767675cc246e" }, "downloads": -1, "filename": "django-google-auth-0.1.0.tar.gz", "has_sig": false, "md5_digest": "13dad556c6a89b029abf661ccb02c289", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5326, "upload_time": "2017-09-06T17:06:59", "url": "https://files.pythonhosted.org/packages/5c/d8/a614cf8c87ffd5f4d524d27fc8fff60c27aae5e02dda0e6ba653ae452948/django-google-auth-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "175e8673f65a1f32901ea244bd8a606f", "sha256": "3d027111b4f0c189fc9e761e28a2cf83d85b5cb0db4b239a235c88dbfcd1e006" }, "downloads": -1, "filename": "django-google-auth-0.2.0.tar.gz", "has_sig": false, "md5_digest": "175e8673f65a1f32901ea244bd8a606f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6327, "upload_time": "2017-09-06T18:25:22", "url": "https://files.pythonhosted.org/packages/6a/4a/a3e4c1e04183ff6eb4a7d16d73ec119270b4095a5d19e97afaa7703e3e9e/django-google-auth-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "6dd3954f7e7b5d8377511e449eeae426", "sha256": "3cf2a1e02c8332f576d72083eba0d18df9f5c15b51319098b60d408dd6e15b67" }, "downloads": -1, "filename": "django-google-auth-0.3.0.tar.gz", "has_sig": false, "md5_digest": "6dd3954f7e7b5d8377511e449eeae426", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6425, "upload_time": "2017-09-08T22:43:59", "url": "https://files.pythonhosted.org/packages/93/e4/cbae48359ef1e91b03e7a958266a8804a8472e77c5dd85b78e9c14264053/django-google-auth-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "092bec8e0f42a857f683f815057c9a31", "sha256": "72d6fbb3f948b9154c1e9ddf4e04d11d4845bab1d80b540a4c69b793fe9b000c" }, "downloads": -1, "filename": "django-google-auth-0.3.1.tar.gz", "has_sig": false, "md5_digest": "092bec8e0f42a857f683f815057c9a31", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6437, "upload_time": "2017-09-09T12:50:21", "url": "https://files.pythonhosted.org/packages/9d/e2/0a5a895a678659cbf464059417f4beba8eccd77d9db20317e4be9f322343/django-google-auth-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "3d4f3c81c1c5947ee1ec408d4afb50b1", "sha256": "369640ebd099258e11ae5876aa0e5699c2cd5b4fd104fff715fa0c91b4247736" }, "downloads": -1, "filename": "django-google-auth-0.3.2.tar.gz", "has_sig": false, "md5_digest": "3d4f3c81c1c5947ee1ec408d4afb50b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6447, "upload_time": "2017-09-09T12:53:56", "url": "https://files.pythonhosted.org/packages/07/ce/e3cef71626d6a312a82e199b0df030aba8bce084ac6053086c93c23a16da/django-google-auth-0.3.2.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "5caa01c6336a7ffe2d7ffa69b3e2a79f", "sha256": "df4aaa6a2c4637e1bf426a99d3a10746cc006676ce3371f181bd26e669204e00" }, "downloads": -1, "filename": "django-google-auth-0.4.0.tar.gz", "has_sig": false, "md5_digest": "5caa01c6336a7ffe2d7ffa69b3e2a79f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6510, "upload_time": "2017-09-21T14:55:08", "url": "https://files.pythonhosted.org/packages/45/80/525fe07092dd7a75acce93b5a0b8efbe6f966fc00e4565bf47cc3e9d4ea3/django-google-auth-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5caa01c6336a7ffe2d7ffa69b3e2a79f", "sha256": "df4aaa6a2c4637e1bf426a99d3a10746cc006676ce3371f181bd26e669204e00" }, "downloads": -1, "filename": "django-google-auth-0.4.0.tar.gz", "has_sig": false, "md5_digest": "5caa01c6336a7ffe2d7ffa69b3e2a79f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6510, "upload_time": "2017-09-21T14:55:08", "url": "https://files.pythonhosted.org/packages/45/80/525fe07092dd7a75acce93b5a0b8efbe6f966fc00e4565bf47cc3e9d4ea3/django-google-auth-0.4.0.tar.gz" } ] }