[GH-ISSUE #826] jwks has 0 rows after creating user and signing in #17086

Closed
opened 2026-04-15 15:02:22 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @natew on GitHub (Dec 8, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/826

Describe the bug

I've added the jwt plugin and tried a couple different configurations, but it seems no rows are created in jwks and if i hit

http://localhost:1421/api/auth/jwks?currentURL=http%3A%2F%2Flocalhost%3A1421%2F

or query the DB jwks table both return empty.

To Reproduce

It's a bit involved because you'd need to add github keys to the .env.example and then copy it to .env...

git checkout natechat2
yarn
cd apps/onechat

And then run:

yarn docker up

In one terminal and:

yarn dev
  1. Go to http://localhost:1421
  2. Hit the user icon top right to login with github
  3. It will log the jwks fetch for you in console once logged in

Expected behavior

I think it should make a key on successful user create/login/jwks fetch, maybe I'm missing something.

Screenshots

CleanShot 2024-12-08 at 13 52 34@2x

See me logging the user and endpoint fetch:

CleanShot 2024-12-08 at 13 52 42@2x

Desktop (please complete the following information):

  • OS: Mac
  • Browser All
Originally created by @natew on GitHub (Dec 8, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/826 **Describe the bug** I've added the jwt plugin and tried a couple different configurations, but it seems no rows are created in `jwks` and if i hit http://localhost:1421/api/auth/jwks?currentURL=http%3A%2F%2Flocalhost%3A1421%2F or query the DB jwks table both return empty. **To Reproduce** It's a bit involved because you'd need to add github keys to the `.env.example` and then copy it to `.env`... ``` git checkout natechat2 yarn cd apps/onechat ``` And then run: ``` yarn docker up ``` In one terminal and: ``` yarn dev ``` 1. Go to http://localhost:1421 2. Hit the user icon top right to login with github 3. It will log the jwks fetch for you in console once logged in **Expected behavior** I think it should make a key on successful user create/login/jwks fetch, maybe I'm missing something. **Screenshots** ![CleanShot 2024-12-08 at 13 52 34@2x](https://github.com/user-attachments/assets/22783e6d-e7b0-4d38-bbd8-eefac0a05ec5) See me logging the user and endpoint fetch: ![CleanShot 2024-12-08 at 13 52 42@2x](https://github.com/user-attachments/assets/6ae18934-2b04-4848-b539-cb1fa2aaf614) **Desktop (please complete the following information):** - OS: Mac - Browser All
GiteaMirror added the locked label 2026-04-15 15:02:22 -05:00
Author
Owner

@natew commented on GitHub (Dec 8, 2024):

Ah nevermind - you have to hit authClient.token() to generate one first. Misread the docs.

Weirdly the authClient.token isn't in the types on mine.

<!-- gh-comment-id:2526515245 --> @natew commented on GitHub (Dec 8, 2024): Ah nevermind - you have to hit `authClient.token()` to generate one first. Misread the docs. Weirdly the `authClient.token` isn't in the types on mine.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#17086