django-graphene-auth-code


Namedjango-graphene-auth-code JSON
Version 1.0.3 PyPI version JSON
download
home_pagehttps://github.com/kingnonso/django-graphene-auth-code
SummaryGraphql and relay authentication with Graphene for Django.
upload_time2024-02-21 01:32:52
maintainerChinonso Ani
docs_urlNone
authorChinonso Ani
requires_python
licenseMIT
keywords api graphql rest relay graphene auth jwt
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            # Django Graphene Auth

[Django](https://github.com/django/django) GraphQL registration and authentication
compatible with the latest versions of Django, Django GraphQL JWT

[![downloads](https://img.shields.io/pypi/dm/django-graphene-auth)](https://pypistats.org/packages/django-graphene-auth)
[![Codecov Coverage](https://img.shields.io/codecov/c/github/ptbang/django-graphene-auth)](https://app.codecov.io/github/ptbang/django-graphene-auth/tree)
[![Pypi](https://img.shields.io/pypi/v/django-graphene-auth.svg)](https://pypi.org/project/django-graphene-auth/)
[![Documentation Status](https://readthedocs.org/projects/django-graphene-auth/badge/?version=latest)](https://django-graphene-auth.readthedocs.io/en/latest/?badge=latest)


## About

This project was based on the forked repository from
[Django GraphQL Auth](https://github.com/PedroBern/django-graphql-auth) -
created by *Pedro Bern* (thanks so much for a great job).

The reason I decided to create this project is that the original doesn't support
the newer versions of django, graphene-django and django-graphql-jwt.
Futhermore, it appears that the original one will not be further developed in the near future.


## Documentation

Documentation is available at [read the docs](https://django-graphene-auth.readthedocs.io/en/latest/).


## Features

* [x] [Docs](https://django-graphene-auth.readthedocs.io/en/latest/)
* [x] Fully compatible with [Relay](https://github.com/facebook/relay>)
* [x] Works with **default or custom** user model
* [x] JWT authentication *(with [Django GraphQL JWT](https://github.com/flavors/django-graphql-jwt))*
* [x] User query with filters *(with [Django Filter](https://github.com/carltongibson/django-filter) and [Graphene Django](https://github.com/graphql-python/graphene-django))*
* [x] User registration with email verification
* [x] Add secondary email, with email verification too
* [x] Resend activation email
* [x] Retrieve/Update user
* [x] Archive user
* [x] Permanently delete user or make it inactive
* [x] Turn archived user active again on login
* [x] Track user status (archived, verified, secondary email)
* [x] Password change
* [x] Password reset through email
* [x] Revoke user refresh tokens on account archive/delete/password change/reset
* [x] All mutations return `success` and `errors`
* [x] Default email templates *(you will customize though)*
* [x] Customizable, no lock-in

## Full Schema

```python

import graphene

from graphql_auth.schema import UserQuery, MeQuery
from graphql_auth import mutations

class AuthMutation(graphene.ObjectType):
    register = mutations.Register.Field()
    verify_account = mutations.VerifyAccount.Field()
    resend_activation_email = mutations.ResendActivationEmail.Field()
    send_password_reset_email = mutations.SendPasswordResetEmail.Field()
    password_reset = mutations.PasswordReset.Field()
    password_set = mutations.PasswordSet.Field() # For passwordless registration
    password_change = mutations.PasswordChange.Field()
    update_account = mutations.UpdateAccount.Field()
    archive_account = mutations.ArchiveAccount.Field()
    delete_account = mutations.DeleteAccount.Field()
    send_secondary_email_activation =  mutations.SendSecondaryEmailActivation.Field()
    verify_secondary_email = mutations.VerifySecondaryEmail.Field()
    swap_emails = mutations.SwapEmails.Field()
    remove_secondary_email = mutations.RemoveSecondaryEmail.Field()

    # django-graphql-jwt inheritances
    token_auth = mutations.ObtainJSONWebToken.Field()
    verify_token = mutations.VerifyToken.Field()
    refresh_token = mutations.RefreshToken.Field()
    revoke_token = mutations.RevokeToken.Field()


class Query(UserQuery, MeQuery, graphene.ObjectType):
    pass


class Mutation(AuthMutation, graphene.ObjectType):
    pass


schema = graphene.Schema(query=Query, mutation=Mutation)
```


## Relay

Import mutations from the ``relay`` module:

```python

from graphql_auth import relay

class AuthMutation(graphene.ObjectType):
   register = relay.Register.Field()
   # ...
```


## Example

Handling user accounts becomes super easy.

```python
mutation {
  register(
    email: "new_user@email.com",
    username: "new_user",
    password1: "123456super",
    password2: "123456super",
  ) {
    success,
    token,  # optional, depending on settings of GRAPHQL_AUTH['ALLOW_LOGIN_NOT_VERIFIED']
    refreshToken  # optional, depending on settings of GRAPHQL_JWT['JWT_LONG_RUNNING_REFRESH_TOKEN']
  }
}
```

Check the status of the new user:

```python
u = UserModel.objects.last()
u.status.verified
# False
```

During the registration, an email with a verification link was sent.

```python
mutation {
  verifyAccount(
    token:"<TOKEN ON EMAIL LINK>",
  ) {
    success
  }
}
```

Now user is verified.

```python
u.status.verified
# True
```

Check the [installation guide](https://django-graphene-auth.readthedocs.io/en/latest/installation/). Or if you prefer, browse the [api](https://django-graphene-auth.readthedocs.io/en/latest/api/).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kingnonso/django-graphene-auth-code",
    "name": "django-graphene-auth-code",
    "maintainer": "Chinonso Ani",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "api graphql rest relay graphene auth jwt",
    "author": "Chinonso Ani",
    "author_email": "achinonso@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/82/9a/f4dbfef7838f0b2a1a622a8985429ad111bf5845e30f48734d84419771b7/django-graphene-auth-code-1.0.3.tar.gz",
    "platform": null,
    "description": "# Django Graphene Auth\n\n[Django](https://github.com/django/django) GraphQL registration and authentication\ncompatible with the latest versions of Django, Django GraphQL JWT\n\n[![downloads](https://img.shields.io/pypi/dm/django-graphene-auth)](https://pypistats.org/packages/django-graphene-auth)\n[![Codecov Coverage](https://img.shields.io/codecov/c/github/ptbang/django-graphene-auth)](https://app.codecov.io/github/ptbang/django-graphene-auth/tree)\n[![Pypi](https://img.shields.io/pypi/v/django-graphene-auth.svg)](https://pypi.org/project/django-graphene-auth/)\n[![Documentation Status](https://readthedocs.org/projects/django-graphene-auth/badge/?version=latest)](https://django-graphene-auth.readthedocs.io/en/latest/?badge=latest)\n\n\n## About\n\nThis project was based on the forked repository from\n[Django GraphQL Auth](https://github.com/PedroBern/django-graphql-auth) -\ncreated by *Pedro Bern* (thanks so much for a great job).\n\nThe reason I decided to create this project is that the original doesn't support\nthe newer versions of django, graphene-django and django-graphql-jwt.\nFuthermore, it appears that the original one will not be further developed in the near future.\n\n\n## Documentation\n\nDocumentation is available at [read the docs](https://django-graphene-auth.readthedocs.io/en/latest/).\n\n\n## Features\n\n* [x] [Docs](https://django-graphene-auth.readthedocs.io/en/latest/)\n* [x] Fully compatible with [Relay](https://github.com/facebook/relay>)\n* [x] Works with **default or custom** user model\n* [x] JWT authentication *(with [Django GraphQL JWT](https://github.com/flavors/django-graphql-jwt))*\n* [x] User query with filters *(with [Django Filter](https://github.com/carltongibson/django-filter) and [Graphene Django](https://github.com/graphql-python/graphene-django))*\n* [x] User registration with email verification\n* [x] Add secondary email, with email verification too\n* [x] Resend activation email\n* [x] Retrieve/Update user\n* [x] Archive user\n* [x] Permanently delete user or make it inactive\n* [x] Turn archived user active again on login\n* [x] Track user status (archived, verified, secondary email)\n* [x] Password change\n* [x] Password reset through email\n* [x] Revoke user refresh tokens on account archive/delete/password change/reset\n* [x] All mutations return `success` and `errors`\n* [x] Default email templates *(you will customize though)*\n* [x] Customizable, no lock-in\n\n## Full Schema\n\n```python\n\nimport graphene\n\nfrom graphql_auth.schema import UserQuery, MeQuery\nfrom graphql_auth import mutations\n\nclass AuthMutation(graphene.ObjectType):\n    register = mutations.Register.Field()\n    verify_account = mutations.VerifyAccount.Field()\n    resend_activation_email = mutations.ResendActivationEmail.Field()\n    send_password_reset_email = mutations.SendPasswordResetEmail.Field()\n    password_reset = mutations.PasswordReset.Field()\n    password_set = mutations.PasswordSet.Field() # For passwordless registration\n    password_change = mutations.PasswordChange.Field()\n    update_account = mutations.UpdateAccount.Field()\n    archive_account = mutations.ArchiveAccount.Field()\n    delete_account = mutations.DeleteAccount.Field()\n    send_secondary_email_activation =  mutations.SendSecondaryEmailActivation.Field()\n    verify_secondary_email = mutations.VerifySecondaryEmail.Field()\n    swap_emails = mutations.SwapEmails.Field()\n    remove_secondary_email = mutations.RemoveSecondaryEmail.Field()\n\n    # django-graphql-jwt inheritances\n    token_auth = mutations.ObtainJSONWebToken.Field()\n    verify_token = mutations.VerifyToken.Field()\n    refresh_token = mutations.RefreshToken.Field()\n    revoke_token = mutations.RevokeToken.Field()\n\n\nclass Query(UserQuery, MeQuery, graphene.ObjectType):\n    pass\n\n\nclass Mutation(AuthMutation, graphene.ObjectType):\n    pass\n\n\nschema = graphene.Schema(query=Query, mutation=Mutation)\n```\n\n\n## Relay\n\nImport mutations from the ``relay`` module:\n\n```python\n\nfrom graphql_auth import relay\n\nclass AuthMutation(graphene.ObjectType):\n   register = relay.Register.Field()\n   # ...\n```\n\n\n## Example\n\nHandling user accounts becomes super easy.\n\n```python\nmutation {\n  register(\n    email: \"new_user@email.com\",\n    username: \"new_user\",\n    password1: \"123456super\",\n    password2: \"123456super\",\n  ) {\n    success,\n    token,  # optional, depending on settings of GRAPHQL_AUTH['ALLOW_LOGIN_NOT_VERIFIED']\n    refreshToken  # optional, depending on settings of GRAPHQL_JWT['JWT_LONG_RUNNING_REFRESH_TOKEN']\n  }\n}\n```\n\nCheck the status of the new user:\n\n```python\nu = UserModel.objects.last()\nu.status.verified\n# False\n```\n\nDuring the registration, an email with a verification link was sent.\n\n```python\nmutation {\n  verifyAccount(\n    token:\"<TOKEN ON EMAIL LINK>\",\n  ) {\n    success\n  }\n}\n```\n\nNow user is verified.\n\n```python\nu.status.verified\n# True\n```\n\nCheck the [installation guide](https://django-graphene-auth.readthedocs.io/en/latest/installation/). Or if you prefer, browse the [api](https://django-graphene-auth.readthedocs.io/en/latest/api/).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Graphql and relay authentication with Graphene for Django.",
    "version": "1.0.3",
    "project_urls": {
        "Documentation": "https://django-graphene-auth.readthedocs.io/en/latest/",
        "Homepage": "https://github.com/kingnonso/django-graphene-auth-code"
    },
    "split_keywords": [
        "api",
        "graphql",
        "rest",
        "relay",
        "graphene",
        "auth",
        "jwt"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b51c9d6fd6472c054b23dc0eb060469045c8dde0a99306a88201c1ede89c0cc4",
                "md5": "3b2d6327ca1713beeb8173e8c2e10b2d",
                "sha256": "fc1f57cb9665a7f8964f44c89251b9223c845846fa5731f9d51e8fc135536c30"
            },
            "downloads": -1,
            "filename": "django_graphene_auth_code-1.0.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3b2d6327ca1713beeb8173e8c2e10b2d",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 28930,
            "upload_time": "2024-02-21T01:32:50",
            "upload_time_iso_8601": "2024-02-21T01:32:50.083071Z",
            "url": "https://files.pythonhosted.org/packages/b5/1c/9d6fd6472c054b23dc0eb060469045c8dde0a99306a88201c1ede89c0cc4/django_graphene_auth_code-1.0.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "829af4dbfef7838f0b2a1a622a8985429ad111bf5845e30f48734d84419771b7",
                "md5": "f27cdac13c70d06dfbc84763d99ecd6a",
                "sha256": "c634ab136941000bc59e20d6752c4c408fae9cd47b4d7e7f157b5850868e3196"
            },
            "downloads": -1,
            "filename": "django-graphene-auth-code-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "f27cdac13c70d06dfbc84763d99ecd6a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 21459,
            "upload_time": "2024-02-21T01:32:52",
            "upload_time_iso_8601": "2024-02-21T01:32:52.339994Z",
            "url": "https://files.pythonhosted.org/packages/82/9a/f4dbfef7838f0b2a1a622a8985429ad111bf5845e30f48734d84419771b7/django-graphene-auth-code-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-21 01:32:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kingnonso",
    "github_project": "django-graphene-auth-code",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "tox": true,
    "lcname": "django-graphene-auth-code"
}
        
Elapsed time: 0.43855s