Code Monkey home page Code Monkey logo

Comments (4)

sgenya avatar sgenya commented on July 17, 2024

I inserted some print()s to the api:

async def remember(self, request, response, identity, **kwargs):
        session = await get_session(request)
        session[self._session_key] = identity
        print(dict(session))
async def identify(self, request):
        session = await get_session(request)
        print(dict(session))
        return session.get(self._session_key)

Below are respective result:

{'AIOHTTP_SECURITY': 'username'}
{}

which mean the AIOHTTP_SECURITY session is gone before identify() is called. This seem to be a bug.

Show your login handler. Method set_cookie doesn't work when response raised. You should use return instead.

from aiohttp-security.

Dreamsorcerer avatar Dreamsorcerer commented on July 17, 2024

Show your login handler. Method set_cookie doesn't work when response raised. You should use return instead.

This is a known regression in 3.7 with HTTPException, it is fixed in 3.8. Other than to work around this regression, you should always raise HTTPExceptions, returning them is deprecated.

from aiohttp-security.

sgenya avatar sgenya commented on July 17, 2024

Show your login handler. Method set_cookie doesn't work when response raised. You should use return instead.

This is a known regression in 3.7 with HTTPException, it is fixed in 3.8. Other than to work around this regression, you should always raise HTTPExceptions, returning them is deprecated.

I don't see 3.8 aiohttp release on PYPI

from aiohttp-security.

derlih avatar derlih commented on July 17, 2024

There is an issue in aiohttp for it.
aio-libs/aiohttp#5366

from aiohttp-security.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.