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
Metadata
Release files for strawberry-django-social-auth 0.4.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| strawberry_django_social_auth-0.4.4.tar.gz | 6.1 kB | Without provenance | Details for strawberry_django_social_auth-0.4.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| strawberry_django_social_auth-0.4.4-py3-none-any.whl | Python 3 | none | any | Details for strawberry_django_social_auth-0.4.4-py3-none-any.whl |
Total release size: 14.0 kB
Security for strawberry-django-social-auth 0.4.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.