def METHOD_NAME(self, code, request):
    nonce = request.data.get("nonce")
    client = request.client
    item = OAuth2AuthorizationCode(
        code=code,
        client_id=client.client_id,
        redirect_uri=request.redirect_uri,
        scope=request.scope,
        user_id=request.user.id,
        nonce=nonce,
    )
    db.session.add(item)
    db.session.commit()
    return code