workos / authkit-nextjs

The WorkOS library for Next.js provides convenient helpers for authentication and session management using WorkOS & AuthKit with Next.js.
MIT License
67 stars 18 forks source link

redirectUri defaults to `""`, overriding NEXT_PUBLIC_WORKOS_REDIRECT_URI #107

Closed sestinj closed 1 month ago

sestinj commented 1 month ago

Right now I have to do the following:

export default authkitMiddleware({
  middlewareAuth: {
    enabled: true,
    unauthenticatedPaths: [],
  },
  redirectUri: process.env.NEXT_PUBLIC_WORKOS_REDIRECT_URI,
});

because redirectUri is by default set to "" right here: https://github.com/workos/authkit-nextjs/commit/845d4ae17be46b88ef423b365b8aa81e9103d09e#diff-0626369278c89781505d2c04865ecce1302e979271bcfb471e029c19addc13a0R8

This was causing me to get 500 errors from WorkOS because the user_management/authorization URL that was constructed in get-authorization-url.ts didn't have a redirect URI.

PaulAsjes commented 1 month ago

Thanks for the report, will have a fix up soon.

sestinj commented 1 month ago

Thanks so much Paul!