astro-community / astro-auth

The Easiest Way To Do Authentication In Astro 🧑🏻‍🚀

Home Page:astro-auth-docs.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong URL fetched when logging in with oauth (google provider)

pierrelefevre opened this issue · comments

Hi!
Been testing this package and seemed like everything was working until I tried the signIn button (@astro-auth/client) in react from a more complex route.

Instead of making the request to /api/auth/signin as it is supposed to, it adds it after the current route, like /my/page/api/auth/signin, which returns a 404.

My hunch is that the fetch call is missing a leading / in the signIn function at const response = await fetch("api/auth/signin".

I tested by copying over the code and importing it locally, and it works when adding the /. (const response = await fetch('/api/auth/signin' )

I'm super new to Astro so let me know if it's wrong :) Hope this helps