Adapter#
- class allauth.headless.adapter.DefaultHeadlessAdapter(request=None)#
The adapter class allows you to override various functionality of the
allauth.headless
app. To do so, pointsettings.HEADLESS_ADAPTER
to your own class that derives fromDefaultHeadlessAdapter
and override the behavior by altering the implementation of the methods according to your own need.- get_frontend_url(urlname, **kwargs)#
Return the frontend URL for the given URL name.
- get_user_dataclass()#
Basic user data payloads are exposed in some of the headless responses. If you need to customize these payloads in such a way that your custom user payload is also reflected in the OpenAPI specification, you wil need to provide a
dataclass
representing the schema of your custom payload, as well as method that takes aUser
instance and wraps it into your dataclass. This method returns thatdataclass
.
- serialize_user(user) Dict[str, Any] #
Returns the basic user data. Note that this data is also exposed in partly authenticated scenario’s (e.g. password reset, email verification).
Do not override this method if you would like your customized user payloads to be reflected in the (dynamically rendered) OpenAPI specification. In that case, override
get_user_dataclass()
anduser_as_dataclass
instead.
- user_as_dataclass(user)#
See
get_user_dataclass()
. This method returns an instance of thatdataclass
, populated with the givenuser
fields.