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
58 stars 14 forks source link

Sign out method errors out #79

Closed thehappybug closed 1 month ago

thehappybug commented 1 month ago

I integrated the WorkOS into a Next.js application using the tutorial on the docs site. The Sign In and the Sign Up links work and I get redirected automatically to my app where the user is shown as logged in. I am able to fetch the user details and show them. However, the signOut method errors out with the following page:

image

If I manually navigate back to the application, the user is correctly shown as signed out, despite the error above.

My sign out logic is simple. I'm only calling the WorkOS signOut method in a server action and not doing anything else.

        <form
          action={async () => {
            "use server";
            await signOut();
          }}
        >
          <DropdownMenuItem asChild>
            <button className="w-full cursor-pointer" type="submit">Log out</button>
          </DropdownMenuItem>
        </form>

Is this a bug? Or do I need to complete some kind of setup in my WorkOS dashboard?

PaulAsjes commented 1 month ago

This is happening because you haven't configured a homepage URL in your WorkOS dashboard. Once you set up a homepage URL under the "Redirects" section in the dashboard it will work as intended.