Better Auth

BA

Better Auth

Join the community to ask questions about Better Auth and get answers from other members.

Join

bug-reports

help

Expo Better Auth breaking with any client plugin "better-auth/client/plugins"

I narrowed down the issue to "better-auth/client/plugins", using any client plugin on expo breaks the app and figured out "jose" was the issue Here's a very basic repo with better auth which has the issue: https://github.com/abhay-ramesh/authTest ❗Someone help me out ...
No description

Organization Plugin: Empty invitation handling

After implementing organization invitation in my project, I discovered that I can send an empty email in the organization.inviteMember And the function would work correctly. Example of the bug: - User sends an invitation to the organization for an empty string email "" - The function takes it normally without throwing an error and stores it in database with email = ""...

Expo: TypeError: Cannot read property 'subtle' of undefined

I updated the Expo client library and want to implement the magic link plugin, but when I try to use this plugin I'm receiving:
TypeError: Cannot read property 'subtle' of undefined
TypeError: Cannot read property 'subtle' of undefined
How could I fix it?...

Documentation is missing userId

The documentation for the Two-Factor database schema is missing the userId in the twoFactor table: https://www.better-auth.com/docs/plugins/2fa#schema...

1.1.19 breaks expo client

It has something to do with module imports, (can't resolve hex random createHash) i tried this but did not helped. ```javascript "better-auth/react": "../../node_modules/better-auth/dist/react.js", "better-auth/client/plugins": "../../node_modules/better-auth/dist/client/plugins.js",...

Manually verifying magic link token throws unexpected invalid_type

In my Expo mobile app, I'm trying to verify the magic link token manually as described here. But when I try to call the verify method with my token, I receive the following error: ```{"code": "__CODE_INVALID_TYPEEXPECTED_STRINGRECEIVED_UNDEFINEDPATH___TOKEN__MESSAGE_REQUIRED__", "details": [{"code": "invalid_type", "expected": "string", "message": "Required", "path": [Array], "received": "undefined"}], "message": "[ { "code": "invalid_type",...

bun: Couldn't read your auth config in auth.ts

[Better Auth]: [#better-auth]: Couldn't read your auth config in auth.ts. Make sure to default export your auth instance or to export as a variable named auth.

Session stealing?

Not sure if this is actually a bug. But try opening better auth in two windows (one in normal, one in incognito). Doing a few refreshses etc - And suddenly user 1 will become user 2? The browsers are totally seperated? Running newest stable version of better-auth. Tried this also on a public facing one and the same happend....

Unable to generate cookie in "after" hooks for sign-in because un-authorized

I am trying to generate a JWT on sign in (although ideally I would need to update the JWT whenever the session changes), and when I do... ```ts if (ctx.path === '/sign-in/email') { if (ctx.request) {...

No response from API in Next.js

I’m having trouble with the API: I added the OpenAPI plugin and tried calling the API, for example via /api/auth/reference, but I don’t get any response. The same issue occurs when I try to register a user. The requests keep loading for a long time until I eventually get an Internal Server Error. Someone else seems to have the same problem: https://github.com/better-auth/better-auth/issues/1394...

userinfo_endpoint key in openid-configuration has incorrect capatlisation.

The property has incorrect capitalisation. The key should be in all lowercase as specified in the OIDC spec. https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata Code: ...

Running SvelteKit on Cloudflare workers I am getting this error

[Better Auth]:\u001b[0m INTERNAL_SERVER_ERROR

Error: Cannot perform I/O on behalf of a different request. I/O objects (such as streams, request/response bodies, and others) created in the context of one request handler cannot be accessed from a different request's handler. This is a limitation of Cloudflare Workers which allows us to improve overall performance. (I/O type: Writable)
[Better Auth]:\u001b[0m INTERNAL_SERVER_ERROR

Error: Cannot perform I/O on behalf of a different request. I/O objects (such as streams, request/response bodies, and others) created in the context of one request handler cannot be accessed from a different request's handler. This is a limitation of Cloudflare Workers which allows us to improve overall performance. (I/O type: Writable)
...

Change email: the second verification email (to the new email) does not redirect

When changing email: 1. First verification email is sent to current email 2. Clicking on the link redirects correctly to the defined callbackUrl, also triggers sending second verification email 3. Second verification email is sent to new email 4. Clicking on the link returns a json instead of redirecting...

openid-configuration - Missing content-type header

It looks like the ’.well-known/openid-configuration’ endpoint is missing its content-type header of value application/json

Using useListOrganization() causes API to call `/api/auth/t-o-j-s-o-n`

I am trying to design an org select screen in react: ``` export function OrganizationSelectScreen() { const organizationsQuery = useQuery({...
No description

Is there a way to extend fields for plugins?

I see that you can extend database values with the user or session table, but are you able to do it with other tables created by plugins, such as organizations?

api.auth.getSession calls SELECT session and SELECT user separately

Calling getSession, if it doesn't find a cookie, it sends 2 DB queries to select the session and then the user. It would be a lot more performant to send a single query with a join, avoiding waterfall latency

Failed to get session, when remember me is checked

im on latest version v.1.1.14 im using drizzle + postgress So when ever remember me is checked i get the error...
No description

authClient.getSession never throws

authClient.getSession appears to never throw no matter the settings. I tried: ```ts export const authClient = createAuthClient({ baseURL: envConfig.VITE_BETTER_AUTH_URL, fetchOptions: {...