Skip to content

[@hono/auth-js] basePath can not be set to an absolute path #1104

@KilianB

Description

@KilianB

Which middleware has the bug?

@hono/auth-js

What version of the middleware?

1.0.5

What version of Hono are you using?

4.7.5

What runtime/platform is your app running on? (with version if possible)

bun 1.2.9

What steps can reproduce the bug?

The backend is running on a different port / url. I attempt to set a new base path via the authConfigManager

import { authConfigManager, SessionProvider } from '@hono/auth-js/react';

authConfigManager.setConfig({
  basePath: 'http://localhost:8000/api/auth', // if auth route is diff from /api/auth
});

And use a simple sign up method

"use client"

import { cn } from '@/lib/utils';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { signIn } from '@hono/auth-js/react';

export function LoginForm({
  className,
  ...props
}: React.ComponentProps<'form'>) {
  // const providers = await getProviders();

  // console.log('Providers', providers);

  return (
    <form
      action={() => {
        // 'use server';
        signIn('github');
      }}
    >
      <button type="submit">Sign In</button>
    </form>
  );
}


### What is the expected behavior?

A request is made against `http://localhost:8000/api/auth/session`

### What do you see instead?

A request is attempted against `http://localhost:3000http://localhost:8000/api/auth/session`

### Additional information

Additional question is if CORS would work correctly in this case and if the cookies would be set for the correct domains.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions