What im missing?

Im using Github provider on next js and hono for api, hono runs on different port, since is used outside of next js, and not nested like it can, but i can login, but then i get this callback ERROR, where im doing something wrong

import { createAuthClient } from 'better-auth/react';
export const authClient = createAuthClient({
  baseURL: 'http://localhost:4000', // hono domain
});

export const { signIn, signUp, useSession } = createAuthClient();

import { PrismaClient } from '@/generated/prisma';
import { betterAuth } from 'better-auth';
import { prismaAdapter } from 'better-auth/adapters/prisma';

const prisma = new PrismaClient();

export const auth = betterAuth({
  database: prismaAdapter(prisma, {
    provider: 'postgresql',
  }),
  socialProviders: {
    github: {
      clientId: process.env.GITHUB_CLIENT_ID as string,
      clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
    },
  },
});


External Hono Implementation
app.use('/api/*', cors({ origin: 'http://localhost:3000', credentials: true }));

app.on(['POST', 'GET'], '/api/auth/**', (c) => auth.handler(c.req.raw));
image.png
Was this page helpful?