Skip to content

Django Graphene Auth

Django registration and authentication with GraphQL with support for most newest versions of Django, Django Graphene, Django GraphQL JWT

downloads Codecov Coverage Pypi Documentation Status


About

This project was based on the forked repository from 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.


Features

  • Awesome docs! (big thanks for Pedro Bern)
  • Fully compatible with Relay
  • Works with default or custom user model
  • JWT authentication (with Django GraphQL JWT)
  • User query with filters (with Django Filter and Graphene Django)
  • User registration with email verification
  • Add secondary email, with email verification too
  • Resend activation email
  • Retrieve/Update user
  • Archive user
  • Permanently delete user or make it inactive
  • Turn archived user active again on login
  • Track user status (archived, verified, secondary email)
  • Password change
  • Password reset through email
  • Revoke user tokens on account archive/delete/password change/reset
  • All mutations return success and errors
  • Default email templates (you will customize though)
  • Customizable, no lock-in
  • Passwordless registration

Example

Handling user accounts becomes super easy.

mutation {
  register(
    email: "new_user@email.com",
    username: "new_user",
    password1: "123456super",
    password2: "123456super"
  ) {
    success,
    errors,
    token,
    refreshToken
  }
}

Check the status of the new user:

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

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

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

Now user is verified.

u.status.verified
# True

Check the installation guide. Or if you prefer, browse the api.