workos/authkit-nextjs

Sign out method errors out

Closed this issue · 1 comments

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?

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.