Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
django-graphql-social-auth
Advanced tools
|Pypi| |Wheel| |Build Status| |Codecov| |Code Climate|
Python Social Auth
_ support for Django GraphQL
_
.. _Django GraphQL: https://github.com/graphql-python/graphene-django
Install last stable version from Pypi.
.. code:: sh
pip install django-graphql-social-auth
See the documentation
_ for further guidance on setting Python Social Auth.
.. _documentation: http://python-social-auth.readthedocs.io/en/latest/configuration/django.html
Add the SocialAuth
mutation to your GraphQL schema.
.. code:: python
import graphene
import graphql_social_auth
class Mutations(graphene.ObjectType):
social_auth = graphql_social_auth.SocialAuth.Field()
Session
_ authentication via accessToken.
.. _Session: https://docs.djangoproject.com/en/2.0/topics/http/sessions/
provider
: provider name from Authentication backend list
_.accessToken
: third-party (Google, Facebook...) OAuth token obtained with any OAuth client... _Authentication backend list: https://github.com/flavors/django-graphql-social-auth/wiki/Authentication-backends
.. code::
mutation SocialAuth($provider: String!, $accessToken: String!) {
socialAuth(provider: $provider, accessToken: $accessToken) {
social {
uid
extraData
}
}
}
Authentication solution based on JSON Web Token
_.
.. _JSON Web Token: https://jwt.io/
Install additional requirements.
.. code:: sh
pip install 'django-graphql-social-auth[jwt]'
Add the SocialAuthJWT
mutation to your GraphQL schema.
.. code:: python
import graphene
import graphql_social_auth
class Mutations(graphene.ObjectType):
social_auth = graphql_social_auth.SocialAuthJWT.Field()
Authenticate via accessToken to obtain a JSON Web Token.
.. code::
mutation SocialAuth($provider: String!, $accessToken: String!) {
socialAuth(provider: $provider, accessToken: $accessToken) {
social {
uid
}
token
}
}
Complete support for Relay
_.
.. _Relay: https://facebook.github.io/relay/
.. code:: python
import graphene
import graphql_social_auth
class Mutations(graphene.ObjectType):
social_auth = graphql_social_auth.relay.SocialAuth.Field()
graphql_social_auth.relay.SocialAuthJWT.Field()
for JSON Web Token (JWT)
_ authentication.
Relay mutations
_ only accepts one argument named input:
.. _Relay mutations: https://facebook.github.io/relay/graphql/mutations.htm
.. code::
mutation SocialAuth($provider: String!, $accessToken: String!) {
socialAuth(input:{provider: $provider, accessToken: $accessToken}) {
social {
uid
}
}
}
If you want to customize the SocialAuth
behavior, you'll need to customize the resolve()
method on a subclass of SocialAuthMutation
or .relay.SocialAuthMutation.
.. code:: python
import graphene
import graphql_social_auth
class SocialAuth(graphql_social_auth.SocialAuthMutation):
user = graphene.Field(UserType)
@classmethod
def resolve(cls, root, info, social, **kwargs):
return cls(user=social.user)
Authenticate via accessToken to obtain the user id.
.. code::
mutation SocialAuth($provider: String!, $accessToken: String!) {
socialAuth(provider: $provider, accessToken: $accessToken) {
social {
uid
}
user {
id
}
}
}
There is a Django project template
_ to start a demo project.
.. _Django project template: https://github.com/ice-creams/graphql-social-auth-template
Gracias @omab
_ / Python Social Auth
_.
.. _@omab: https://github.com/omab .. _Python Social Auth: http://python-social-auth.readthedocs.io/
.. |Pypi| image:: https://img.shields.io/pypi/v/django-graphql-social-auth.svg :target: https://pypi.python.org/pypi/django-graphql-social-auth
.. |Wheel| image:: https://img.shields.io/pypi/wheel/django-graphql-social-auth.svg :target: https://pypi.python.org/pypi/django-graphql-social-auth
.. |Build Status| image:: https://travis-ci.org/flavors/django-graphql-social-auth.svg?branch=master :target: https://travis-ci.org/flavors/django-graphql-social-auth
.. |Codecov| image:: https://img.shields.io/codecov/c/github/flavors/django-graphql-social-auth.svg :target: https://codecov.io/gh/flavors/django-graphql-social-auth
.. |Code Climate| image:: https://api.codeclimate.com/v1/badges/c579bcfde0fbb7f6334c/maintainability :target: https://codeclimate.com/github/flavors/django-graphql-social-auth
FAQs
Python Social Auth support for Django GraphQL
We found that django-graphql-social-auth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.