next-intl icon indicating copy to clipboard operation
next-intl copied to clipboard

Change from NextAuth v4 syntax to v5 syntaxes

Open JulianJorgensen opened this issue 1 year ago • 6 comments

Here's initial draft of pull request. Apologies for format issues.

JulianJorgensen avatar Nov 03 '23 15:11 JulianJorgensen

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-intl-example-next-13 ❌ Failed (Inspect) Nov 3, 2023 3:22pm

vercel[bot] avatar Nov 03 '23 15:11 vercel[bot]

@JulianJorgensen is attempting to deploy a commit to the next-intl Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Nov 03 '23 15:11 vercel[bot]

Apparently, this does not work anymore

const authMiddleware = auth(
  (req) => intlMiddleware(req),
  {
    callbacks: {
      authorized: ({token}) => token != null
    },
    pages: {
      signIn: '/login'
    }
  }
);

amarincolas avatar Nov 07 '23 09:11 amarincolas

I'm having issues with this... any ideas?

DiegoGonzalezCruz avatar Jan 02 '24 20:01 DiegoGonzalezCruz

I got this working using this workaround. This is necessary due to a bug in next-auth itself. So this may need to be parked until that bug is resolved.

alessandrojcm avatar Jan 03 '24 14:01 alessandrojcm

@ScreamZ shared his implementation here: https://github.com/amannn/next-intl/discussions/1170. Might be worth checking that out when we continue with this PR.

Also https://github.com/amannn/next-intl/pull/899 provides a potential implementation.

For context, I didn't look further into this yet as I'm waiting for Auth.js v5 stable to be released. I'd like to avoid keeping up to date with their beta versions, as long as the API might still change.

Many thanks to everyone who has already looked into this and provided help! 🙌

amannn avatar Jul 08 '24 13:07 amannn