How are built-in API endpoints / routes enabled?

According to the docs when using emailandpassword on the server one can use the endpoint /sign-up/email, https://www.better-auth.com/docs/authentication/email-password#sign-up. So when I Hono is set up, like in the bun-hono-better-auth project, https://github.com/ProMehedi/bun-hono-better-auth/blob/main/server/src/server.ts // Better-Auth - Handle all auth routes app.all('/api/auth/*', async (c) => { return await auth.handler(c.req.raw) }) it might be reasonable to expect that for example a basic API endpoint like /sign-up/email might be available without your own implementation. But turns out it, and others, aren't there, I'm getting just 404s, so something else is needed. But what is it? Is it just that this expectation that there are starter API endpoints for signups, login, logout and some others coming with BetterAuth, extended or modified with emailAndPassword, for example, that expectation is ill-founded? You still have to implement these? It's not optional to do so only when you have extended needs? In this case it's in relation to Hono as backend server I'm asking. I looked at the bun-hono-better-auth project, because in my own project I couldn't get these API end points to be available either, using Hono.
The auth config is pretty much this one, https://github.com/ProMehedi/bun-hono-better-auth/blob/main/server/src/config/auth.config.ts, though I commented out social. Thankful for any pointers.
GitHub
bun-hono-better-auth/server/src/server.ts at main · ProMehedi/bun-...
A high-performance full-stack template using Bun, Hono, and Better Auth with MongoDB integration. - ProMehedi/bun-hono-better-auth
Email & Password | Better Auth
Implementing email and password authentication with Better Auth.
11 Replies
Stromkraft
StromkraftOP2mo ago
I've had some progress now with /sign-up/email. The /signup mentioned in one of the READMEs of the bun-hono-better-auth project still gives me 404.
The Untraceable
The Untraceable2mo ago
Its mounted at /api/auth So /api/auth/sign-up/email The documentation doesnt give you the full exact path because you can configure it, if you want to have it where /sign-up/email then I guess you could just mount it at /
Stromkraft
StromkraftOP2mo ago
Yes, the /api/auth/ was implied as I shared that path code. I've managed to make some edits and tuned in /sign-up/email and this path works now. I must assume that /sign-up, or maybe /signup is supposed to work for social, but even when enabling socialProviders these keep serving 404s only. My hope was these should at least give an error or so, when called.
The Untraceable
The Untraceable2mo ago
Youre not really meant to call the endpoints manually On hono just use server functions provided In nextjs client side you can use authClient
Stromkraft
StromkraftOP2mo ago
I'm testing them, right?
The Untraceable
The Untraceable2mo ago
Theyre already tested against iirc In the testing suite But If you mean testing as in seeing functionality just use the openapi plugin You get a nice gui
Stromkraft
StromkraftOP2mo ago
Postman is no good for this you mean? I'll have a look at the testing suite, thanks.
The Untraceable
The Untraceable2mo ago
By that i mean the x.test.js files in the repo. Eh it shuld work but youre just better off using the openapi plugin. It does the testing you'd want i guess
The Untraceable
The Untraceable2mo ago
No description
Stromkraft
StromkraftOP2mo ago
OK, Seems great. Thank you. Adding it. Yes, this is very useful, especially as Hono's showRoutes naturally won't show URLs handled by BetterAuth. Thank you again!

Did you find this page helpful?