Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add signOut to the client functions #180

Closed
fierysolid opened this issue Jan 16, 2025 · 5 comments · Fixed by #183
Closed

Add signOut to the client functions #180

fierysolid opened this issue Jan 16, 2025 · 5 comments · Fixed by #183
Labels
enhancement New feature or request

Comments

@fierysolid
Copy link

Quite a bit of my app is done in client components behind auth. It would be great if there was a provided function to destroy the session cookie from the client since server components can't be placed inside of client components.

@PaulAsjes PaulAsjes added the enhancement New feature or request label Jan 17, 2025
@kevinmitch14
Copy link

signOut() is a server action, so it can be called from a client component without issue! Is there something I am missing?

<Button onClick={signOut}>
  Sign Out
</Button>

@fierysolid
Copy link
Author

fierysolid commented Jan 17, 2025

Maybe it's just my setup, but I get this error:

[0] Module build failed: UnhandledSchemeError: Reading from "node:crypto" is not handled by plugins (Unhandled scheme).
[0] Webpack supports "data:" and "file:" URIs by default.
[0] You may need an additional plugin to handle "node:" URIs.
[0] Import trace for requested module:
[0] node:crypto
[0] ./node_modules/@workos-inc/node/lib/common/crypto/node-crypto-provider.js
[0] ./node_modules/@workos-inc/node/lib/index.js
[0] ./node_modules/@workos-inc/authkit-nextjs/dist/esm/workos.js
[0] ./node_modules/@workos-inc/authkit-nextjs/dist/esm/authkit-callback-route.js
[0] ./node_modules/@workos-inc/authkit-nextjs/dist/esm/index.js

It does appear I can fix this by altering my webpack config, but I wonder if that's totally necassary:

  webpack: (config) => {
    config.externals.push({
      'node:crypto': 'commonjs crypto',
      'node:https': 'commonjs https',
      'node:http': 'commonjs http',
    });
    return config;
  },

@kevinmitch14
Copy link

What version are you using? I wonder if #147 helps your case

@fierysolid
Copy link
Author

"@workos-inc/authkit-nextjs": "1.1.0",

@fierysolid
Copy link
Author

It seems that Webpack 5 removed the auto polyfills for these node internals, so this is likely the correct fix, but it may be helpful to make a note of this in the docs if so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

3 participants