Issues with auth.api.signInSocial()

Hey, I am building out a Hono backend with an Astro Frontend. I want to auth with an api endpoint. I have set this up as /api/v1/auth/signin

When I hit that in a browser, I dont get any errors from better-auth in console, I get redirected to Discord but get the following.
{
  "redirect_uri": [
    "Not a well formed URL."
  ]
}


This is the route.
app.get('/signin', async (c) => {
  console.log(c.env.BETTER_AUTH_URL);
  const signin = await c.var.auth.api.signInSocial({
    body: {
      provider: 'discord',
      callbackURL: `http://localhost:8787/api/v1/auth/callback`,
    },
  });

  return c.redirect(signin.url ?? '/');
});


This is the url I am being redirected to, which is clearly deformed.
https://discord.com/api/oauth2/authorize?scope=identify+email&response_type=code&client_id=<redacted>&redirect_uri=%2Fcallback%2Fdiscord&state=-_FYN0qJO9vd3AcKkofOirG3Xqig1YjksPBvhHNdod0&prompt=none


Anyone run into similar issues?
Was this page helpful?