• r

    rp

    10 months ago
    @porcellus can possible help with this
  • r

    rp

    10 months ago
    Also, session verification doesn’t require a call to the db. It’s stateless with us too 🙂
  • p

    porcellus

    10 months ago
    I'll test this in a minute, but I'd try doing this in the guard. You should be able to modify the request object there which is also easy to access through a param decorator.
  • p

    porcellus

    10 months ago
    Yeah, this seems to work: just add the DB calls into the guard after checking for the error and modify the request object. I'll add a codesnippet in a sec
  • r

    rp

    10 months ago
    Thank u @porcellus
  • p

    porcellus

    10 months ago
    So something like this: https://pastebin.com/nVge7CM1
  • p

    porcellus

    10 months ago
    Also, this would be done for all requests passing through that guard, which might not be necessary. If you just want to get the data inside your controller you could just move your code into a parameter decorator, that's a bit cleaner than modifying the request obj.
  • ?

    user

    10 months ago
    @User I am looking over the solution you provided now, thank you so much for your help! I will let you know what I discover. Are you able to inject into the decorator code? For some reason I thought that wasn't possible, although now that I am thinking about it, I'm not sure why it wouldn't be possible.
  • p

    porcellus

    10 months ago
    Well injecting into decorators doesn't work out-of-the-box AFAIK, but you could do something like this: https://stackoverflow.com/a/67455016 (the accepted answer recommends the guard + param decorator approach).
  • Ankur Tyagi

    Ankur Tyagi

    10 months ago
    @User Welcome to Supertokens.