Next.js Discord

Discord Forum

How to get ip address from server action?

Answered
itsMU1X posted this in #help-forum
Open in Discord
i need to make server function:
const emailAuth = async (email?: string) => {
        "use server"
        console.log("hi from server!", email)
        // /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(email)

        if (!email)
            return {
                meow: 123,
            }

        return {
            meow: -1,
        }
    }


but i don't know how to get the user ip address?
Answered by itsMU1X
i tried to use headers function from "next/headers" but no clue i guess because working on localhost maybe
View full answer

1 Reply

i tried to use headers function from "next/headers" but no clue i guess because working on localhost maybe
Answer