blitz: Toolkit: Authenticate and RedirectTo not working as expected

What is the problem?

Using the latest toolkit .60.

Home.authenticate = { redirectTo: Routes.LoginPage() }

Doesn’t seem to do anything. Have confirmed nothing in the application Tab in dev tools.

Also

LoginPage.redirectAuthenticatedTo = Routes.Home()

Seems to create the following error, when authenticated and hitting the page:

alt text

Run blitz -v and paste the output here:

Blitz version: 2.0.0-alpha.53 (global)
Blitz version: 2.0.0-alpha.60 (local)
macOS Monterey | darwin-arm64 | Node: v18.4.0


 Package manager: npm

  System:
    OS: macOS 12.4
    CPU: (10) arm64 Apple M1 Pro
    Memory: 556.45 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.4.0 - ~/.nvm/versions/node/v18.4.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.4.0/bin/yarn
    npm: 8.12.1 - ~/.nvm/versions/node/v18.4.0/bin/npm
  npmPackages:
    @prisma/client: Not Found
    blitz: Not Found
    next: Not Found
    prisma: Not Found
    react: Not Found
    react-dom: Not Found
    typescript: Not Found

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 19 (15 by maintainers)

Most upvoted comments

Just did a fresh install of blitz and ran into the hydration mismatch error reported above, was able to fix it by upgrading to react and react-dom to v18.2.0

If using typescript however, you will also need to upgrade to next 18.2.0, since error messages around the <style jsx global> will other wise persist.

It seems Passport.js integration is broken. I tried to refactor a legacy Blitz app to v2 and after a lot of plumbing and several hours, I decided to give up.

I stumbled upon a Missing Blitz sessionMiddleware! error when processing a callback for a Passport strategy. Blitz passport adapter does a session assertion before processing the callback request and it will always fail because a previous anonymous session has not been created or even if there’s an existing one, it is not able to access to it (I tried to create one manually).

Can you open a different issue for this?