Skip to content

AuthSessionMissingError: Auth session missing! when getUser() in an API route NEXT.JS. #28914

Answered by denull0
denull0 asked this question in Questions
Discussion options

You must be logged in to vote

My workaround is to pass cookies manually with the api call

      const cookiesStore = cookies();

      const metadataResponse = await fetch(
        `${process.env.NEXT_PUBLIC_URL}/api/insert-photo`,
        {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
            cookie: cookiesStore, // Pass the cookies manually
          },
        }
      );

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@kiikoh
Comment options

Comment options

You must be logged in to vote
2 replies
@silentworks
Comment options

@denull0
Comment options

Answer selected by denull0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants