Skip to content

Commit 0d76d0c

Browse files
authored
Expose WorkOS client for advanced use cases (#204)
* expose the getWorkOS function in the module exports Allow users direct access to the WorkOS instance * add a section about exposing the WorkOS SDK to the README
1 parent 7b3bd9c commit 0d76d0c

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,22 @@ export default authkitMiddleware({
401401
});
402402
```
403403
404+
### Advanced: Direct access to the WorkOS client
405+
406+
For advanced use cases or functionality not covered by the helper methods, you can access the underlying WorkOS client directly:
407+
408+
```typescript
409+
import { getWorkOS } from '@workos-inc/authkit-nextjs';
410+
411+
// Get the configured WorkOS client instance
412+
const workos = getWorkOS();
413+
414+
// Use any WorkOS SDK method
415+
const organizations = await workos.organizations.listOrganizations({
416+
limit: 10,
417+
});
418+
````
419+
404420
### Debugging
405421
406422
To enable debug logs, initialize the middleware with the debug flag enabled.

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import { handleAuth } from './authkit-callback-route.js';
22
import { authkit, authkitMiddleware } from './middleware.js';
33
import { withAuth, refreshSession } from './session.js';
44
import { getSignInUrl, getSignUpUrl, signOut } from './auth.js';
5+
import { getWorkOS } from './workos.js';
56

67
export * from './interfaces.js';
78

89
export {
10+
getWorkOS,
911
handleAuth,
1012
//
1113
authkitMiddleware,

0 commit comments

Comments
 (0)