Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Django registration and authentication with GraphQL.

License

NotificationsYou must be signed in to change notification settings

rahulkp220/django-graphql-auth

 
 

Repository files navigation

Django registration and authentication with GraphQL.

downloadsCodecov CoverageBuild StatusPypiDocumentation Statuscontributions welcome

Demo

Demo Video

About

Abstract all the basic logic of handling user accounts out of your app,so you don't need to think about it and canget up and running faster.

No lock-in. When you are ready to implement your own code or this packageis not up to your expectations , it'seasy to extend or switch toyour implementation.

Documentation

Documentation is available atread the docs.

Features

  • Awesome docs 🎉
  • Fully compatible withRelay
  • Works withdefault or custom user model
  • JWT authentication(withDjango GraphQL JWT)
  • User query with filters(withDjango Filter andGraphene 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 refresh tokens on account archive/delete/password change/reset
  • All mutations returnsuccess anderrors
  • Default email templates(you will customize though)
  • Customizable, no lock-in

Full Schema

importgraphenefromgraphql_auth.schemaimportUserQuery,MeQueryfromgraphql_authimportmutationsclassAuthMutation(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 registrationpassword_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 inheritancestoken_auth=mutations.ObtainJSONWebToken.Field()verify_token=mutations.VerifyToken.Field()refresh_token=mutations.RefreshToken.Field()revoke_token=mutations.RevokeToken.Field()classQuery(UserQuery,MeQuery,graphene.ObjectType):passclassMutation(AuthMutation,graphene.ObjectType):passschema=graphene.Schema(query=Query,mutation=Mutation)

Relay

Import mutations from therelay module:

fromgraphql_authimportrelayclassAuthMutation(graphene.ObjectType):register=relay.Register.Field()# ...

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 theinstallation guide or jump to thequickstart. Or if you prefer, browse theapi.

Contributing

SeeCONTRIBUTING.md

About

Django registration and authentication with GraphQL.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python99.0%
  • Other1.0%

[8]ページ先頭

©2009-2025 Movatter.jp