Token Strategy#

class allauth.headless.tokens.base.AbstractTokenStrategy#
create_access_token(request: HttpRequest) str | None#

Create an access token.

While session tokens are required to handle the authentication process, depending on your requirements, a different type of token may be needed once authenticated.

For example, your app likely needs access to other APIs as well. These APIs may even be implemented using different technologies, in which case having a stateless token, possibly a JWT encoding the user ID, might be a good fit.

We make no assumptions in this regard. If you need access tokens, you will have to implement a token strategy that returns an access token here.

abstract create_session_token(request: HttpRequest) str#

Create a session token for the request.session.

get_session_token(request: HttpRequest) str | None#

Returns the session token, if any.

abstract lookup_session(session_token: str) SessionBase | None#

Looks up the Django session given the session token. Returns None if the session does not / no longer exist.