Headless API

Since version 0.9.1

The Vanty Starter Kit as a headless API for a separate Frontend like Vue or React you will need to extend the backend.

Please be aware that using Django as a headless API means you will be losing out on the majority of the logic in the Django views and templates.


The dj_rest_auth library is used to extend django-allauth to provide the following endpoints for managing the user registration and authentication flow.

  • User Registration with activation
  • Login/Logout
  • Retrieve/Update the Django User model
  • Password change
  • Password reset via e-mail
  • Social Media authentication

Enable social authentication

The allauth library is already installed with five providers enabled. However, it only includes Django-based and not DRF API views. To use social auth you will need to add custom views for each provider.

For example to add social auth Facebook:

add a custom view

from allauth.socialaccount.providers.facebook.views import FacebookOAuth2Adapter
from dj_rest_auth.registration.views import SocialLoginView

class FacebookLogin(SocialLoginView):
    adapter_class = FacebookOAuth2Adapter

add the url

urlpatterns += [
    path('dj-rest-auth/facebook/', FacebookLogin.as_view(), name='fb_login')

See the dj_rest_auth docs for adding connect views for social accounts.

Enable JWT authentication

This is enabled by default via the djangorestframework-simplejwt library. You can configure your preferences in config/settings/base.py.

    JWT_AUTH_COOKIE = 'my-app-auth'
    JWT_AUTH_REFRESH_COOKIE = 'my-refresh-token'
    REST_USE_JWT = True

You can also customise to suit your needs, for example change the claims attached to tokens.

Available endpoints.

The available endpoints depend on which apps are installed. See the full listing here.

The following apps are fully supported:

  • teams
  • users
  • workspaces
  • webhooks

The payments are is not yet fully supported. The endpoints to be replicated are in apps.payments/views.py. We plan on extending

Client generation

You can also generate clients for pretty much every language out there. See the swagger codegen docs for more info.

Copyright © 2022 www.advantch.com