Graphql Social authentication system with Strawberry for Django.
Project description
Strawberry-django Social Auth
Django social authentication with Strawberry using Social Django.
About
This Library was inspired by Django-graphql-social-auth.
Django Social Auth for Strawberry Graphql engine.
Docs can be found here
Features
- Awesome docs!
- Social Auth
- Profile pic's URL storage in User's model
- Relay Support (Coming Soon...)
Installation:
pip install strawberry-django-social-auth
- Add this for Avatar support in
settings.py
SOCIAL_AUTH_PIPELINE = [
...
'gql_social_auth.pipeline.get_avatar', # Get Avatar Pipeline
]
Usage:
- Use built-In Mutation
@strawberry.type
class Mutation:
social_auth = mutations.SocialAuth.field
schema = strawberry.Schema(query=Query, mutation=Mutation)
- Customize the Usage of Mutation using the decorator
from gql_social_auth.decorators import social_auth
from gql_social_auth.types import SocialAuthInput
@strawberry.type
class CustomMutation:
@strawberry.mutation
@social_auth
def social_auth(self, info: Info, _input: SocialAuthInput, user, errors) -> CustomReturnType:
# user: User object from model
# errors: If any errors occurred during the process of getting the social auth
# Note: Any of the user or errors is None at a time, both can't be None at the same time...
if errors is not None:
# Handle Error here
# Use user Object here...
Calling:
mutation SocialAuth($provider: String!, $accessToken: String!){
socialAuth(provider: $provider, accessToken: $accessToken){
uid
avatar
extraData
errors
success
refreshToken {
created
isExpired
expiresAt
token
revoked
}
token {
token
payload {
exp
origIat
}
}
user {
email
archived
dateJoined
firstName
isActive
id
isStaff
isSuperuser
lastLogin
lastName
logentrySet {
pk
}
status {
archived
verified
}
verified
}
}
}
Contributing
See CONTRIBUTING.md
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for strawberry_django_social_auth-0.4.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bb93d1aee8d56ced765b59f590d4431d5a45e2167778ae6a8427fc45f58a914 |
|
MD5 | 7271e7ba0020fee5bf91c48b8bf31998 |
|
BLAKE2b-256 | 994ee02dfe70603b3f61407ba62505cec2c61ba2cfc90189c1924f8b5d4d2f46 |
Close
Hashes for strawberry_django_social_auth-0.4.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edc9bee2ceba3ffe593fabfb22a6adb15e80f5f1a5c1f436852817482a7971a6 |
|
MD5 | ada8313edd17d14deed3564c93f05da5 |
|
BLAKE2b-256 | 54ff004cb434f9227a775ea2b38ae002c24b9752eb11d88574e324d95ac16fd8 |