I am working on an e commerce store , on the click of sign in , it pops up the google sign in , once i sign in with google . It redirects to local host instead of the wesbsite url . How do i fix it
I have a feeling it is cause of my
NEXTAUTH_URL = HTTP://LOCALHOST
below is the code
import { useSelector } from "react-redux";
import Header from "../components/Header";
import CheckoutProduct from "../components/CheckoutProduct";
import { selectItems, selectTotal } from "../slices/basketSlice";
import Currency from "react-currency-formatter";
import { signIn, signOut, useSession } from "next-auth/client"
function Checkout() {
const items = useSelector(selectItems);
const total = useSelector(selectTotal)
const [session] = useSession();
<button role="link"
onClick={signIn} className={`button mt-2 font-semibold pl-5 pr-5 `}>
SIGN IN
</button>
<button
disabled={!session} className={`button mt-2 ${!session && 'from-gray-300 to-gray-500 border-gray-200 text-gray-300 cursor cursor-not-allowed'}`}
>
{!session ? "signin to checkout" : "Pay with card"}
</button>
)}
</div>
</main>
</div>
)
}
export default Checkout
HERE IS MY NEXTAUTH FILE
import NextAuth from "next-auth"
import Providers from "next-auth/providers";
export default NextAuth({
// Configure one or more authentication providers
providers: [
Providers.Google({
clientId: process.env.GOOGLE_ID,
clientSecret: process.env.GOOGLE_SECRET,
}),
// ...add more providers here
],
})
HERE IS MY ENV FILE
# Authentication
GOOGLE_ID=###########################################
GOOGLE_SECRET=############################################
NEXTAUTH_URL=http://localhost:3000
I have a feeling it is cause of my NEXTAUTH_URL = HTTP://LOCALHOST