things that are missing from their docs:
- how can the backend authenticate any given user on interactions?
- what does the callback actually do? not clear how or why this works
- for instance something like this:
When a GET request hits your /auth/callback endpoint, this handler:
- Processes the authentication callback from WorkOS
- Handles the OAuth/SSO flow completion
- Sets up any necessary session cookies
- Returns a Response object that typically redirects the user to your specified returnPathname ('/' in your case)
- you should link to this in the QuickStart section on Callbacks:
- I wanted to figure out how to get the UserId object in an edge function (e.g. a NextJs route) but couldn’t easily find this in the docs. I eventually found it in Github code example: https://github.com/workos/next-authkit-example/blob/main/src/app/api/get-name/route.ts
- I can’t find getSession mentioned anywhere in the reference docs
- It’s also really unclear how getSession works — I don’t have a good model of how it fits into the authentication flow.
- signOut is confusing
- the instructions for how to write the signOut function seem to create build errors
./node_modules/@workos-inc/authkit-nextjs/dist/esm/impersonation.js
Error: x It is not allowed to define inline "use server" annotated Server Actions in Client Components.
| To use Server Actions in a Client Component, you can either export them from a separate file with "use server" at the top, or pass them down through props from a Server Component.
|
| Read more: https://nextjs.org/docs/app/api-reference/functions/server-actions#with-client-components
|
,-[/Users/malin/code/fractalbootcamp/deployments/felt-sense/node_modules/@workos-inc/authkit-nextjs/dist/esm/impersonation.js:50:1]
47 | lineHeight: '1.4',
48 | } },
49 | React.createElement("form", { action: async () => {
50 | 'use server';
: ^^^^^^^^^^^^
51 | await signOut();
52 | }, style: {
53 | display: 'flex',
`----
Import trace for requested module:
./node_modules/@workos-inc/authkit-nextjs/dist/esm/impersonation.js
./node_modules/@workos-inc/authkit-nextjs/dist/esm/index.js
./src/app/components/SpeakArea.tsx
> Build failed because of webpack errors
error: script "build" exited with code 1