'"better-auth/plugins"' has no exported member 'sessionMiddleware'.
Expected behaviour:
I should be able to import sessionMiddleware from the better-auth plugin to verify if a user has an active session.
Current behaviour:
When attempting to use sessionMiddleware from the better-auth plugin, I encounter an error indicating that the module has no exported member named sessionMiddleware.
Better-Auth version
v1.1.3 (Latest)
Reproduction Steps
1. Install the better-auth plugin (v1.1.3).
2. Attempt to import and use sessionMiddleware in the code.
3. Encounter the error: "Module has no exported member 'sessionMiddleware'."
Purpose
I am building an Attribute-Based Access Control (ABAC) proof of concept using better-auth by creating a custom plugin. The sessionMiddleware is a key component for session validation in this context.
Code Example
I have created a Gist containing the relevant code for replication and further context: Link to Gist... https://gist.github.com/AdzeB/ee733f6d4c8409e67babd89aefb9147d
Additional Information
I have followed the official documentation for better-auth but could not find references to the sessionMiddleware export.
The issue persists even after reinstalling the plugin and verifying the package integrity.
Request
1. Can you confirm whether sessionMiddleware is officially supported and exported in version 1.1.3?
2. If not, could you suggest an alternative or workaround for session validation?
3. Additionally, I would appreciate any feedback on the implementation details provided in the linked Gist.
Thank you for your assistance!
Gist
ABAC Proof of concept
ABAC Proof of concept. GitHub Gist: instantly share code, notes, and snippets.
4 Replies
@bekacru can you have a look at this
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
Hey guys @wild-silent @Reis
you should improt from here
the docs will be updated
@bekacru thank you, also have you managed to look at the way I want to implement ABAC