Collect client-hints, in addition to the User Agent string #1363

Closed
opened 2026-03-13 08:34:58 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @dimitrisnl on GitHub (Jun 16, 2025).

Is this suited for github?

  • Yes, this is suited for github

The sessions table currently collects the userAgent string, but relying on this for browser and OS detection is often inaccurate and outdated.

Example

Given the following user agent string:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36

Most parsers will interpret this as:

Chrome on macOS 10.15.7

In reality, the request came from:

Brave on macOS 15.0.1

This occurs because Chromium-based browsers are increasingly reducing user-agent granularity, making it difficult to infer accurate browser and platform details.

Why this matters

Since Better Auth already exposes session metadata via authClient.listSessions(), having more accurate client details would make the feature significantly more useful.

Describe the solution you'd like

I can't propose a specific solution; there are various approaches. I believe it would be best to just expose the raw client hints and let the developer handle parsing using the library of their choosing.

Describe alternatives you've considered

n/a - I believe there might be a workaround with hooks, but since we already store userAgent I thought we can include CH as well.

Additional context

No response

Originally created by @dimitrisnl on GitHub (Jun 16, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. The sessions table currently collects the `userAgent` string, but relying on this for browser and OS detection is often inaccurate and outdated. #### Example Given the following user agent string: ``` Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36 ``` Most parsers will interpret this as: > Chrome on macOS 10.15.7 In reality, the request came from: > Brave on macOS 15.0.1 This occurs because Chromium-based browsers are increasingly reducing user-agent granularity, making it difficult to infer accurate browser and platform details. #### Why this matters Since Better Auth already exposes session metadata via `authClient.listSessions()`, having more accurate client details would make the feature significantly more useful. ### Describe the solution you'd like I can't propose a specific solution; there are various approaches. I believe it would be best to just expose the raw client hints and let the developer handle parsing using the library of their choosing. ### Describe alternatives you've considered n/a - I believe there might be a workaround with hooks, but since we already store `userAgent` I thought we can include CH as well. ### Additional context _No response_
GiteaMirror added the enhancement label 2026-03-13 08:34:58 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 15, 2025):

Hi, @dimitrisnl. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You suggested enhancing the sessions table by collecting client hints in addition to the user agent string.
  • The goal is to improve browser and OS detection accuracy.
  • You proposed exposing raw client hints through authClient.listSessions() for developers to parse and use.
  • There has been no further activity or comments on this request.

Next Steps:

  • Please let me know if this feature is still relevant to the latest version of better-auth by commenting on this issue.
  • If I do not hear back within 7 days, I will automatically close this issue.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Sep 15, 2025): Hi, @dimitrisnl. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You suggested enhancing the sessions table by collecting client hints in addition to the user agent string. - The goal is to improve browser and OS detection accuracy. - You proposed exposing raw client hints through `authClient.listSessions()` for developers to parse and use. - There has been no further activity or comments on this request. **Next Steps:** - Please let me know if this feature is still relevant to the latest version of better-auth by commenting on this issue. - If I do not hear back within 7 days, I will automatically close this issue. Thank you for your understanding and contribution!
Author
Owner

@dimitrisnl commented on GitHub (Sep 16, 2025):

Not using better auth anymore, and since there's no activity it's safe to close

@dimitrisnl commented on GitHub (Sep 16, 2025): Not using better auth anymore, and since there's no activity it's safe to close
Author
Owner

@dosubot[bot] commented on GitHub (Sep 16, 2025):

Thank you for closing this issue, dimitrisnl! We appreciate your help in keeping the project organized.

@dosubot[bot] commented on GitHub (Sep 16, 2025): Thank you for closing this issue, dimitrisnl! We appreciate your help in keeping the project organized.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1363