Skip to content

Add client side auth#147

Merged
PaulAsjes merged 22 commits intomainfrom
fix/impersonation-use-client
Jan 13, 2025
Merged

Add client side auth#147
PaulAsjes merged 22 commits intomainfrom
fix/impersonation-use-client

Conversation

@PaulAsjes
Copy link
Copy Markdown
Contributor

@PaulAsjes PaulAsjes commented Dec 10, 2024

Fixes #80
Hopefully fixes #146

Introduces new auth hooks via the AuthKitProvider component. Also separates server and client components so no crypto modules are accidentally included, causing errors in client components that attempt to use this library.

@chamini2
Copy link
Copy Markdown

Hi is there any timeline for this? I am blocked to integrate into our existing app without major refactors.

@PaulAsjes PaulAsjes changed the title [wip] Add client side auth Add client side auth Jan 2, 2025
@monolithed
Copy link
Copy Markdown

It’d be awesome to also show an implementation of Magic Auth using workos.userManagement.authenticateWithMagicAuth 🙂

@PaulAsjes PaulAsjes merged commit 3714fb8 into main Jan 13, 2025
@PaulAsjes PaulAsjes deleted the fix/impersonation-use-client branch January 13, 2025 10:44
Comment thread README.md

export default function MyComponent() {
// Retrieves the user from the session or returns `null` if no user is signed in
const { user, loading } = useAuth();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PaulAsjes this function no longer takes {ensureSignedIn: true} for it's arguments.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the comment below were fixed in v1.0.2.

Copy link
Copy Markdown
Contributor

@jessedijkstra jessedijkstra Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update!

Comment thread README.md
const { user } = await withAuth({ ensureSignedIn: true });

// Client component
const { user, loading } = useAuth({ ensureSignedIn: true });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PaulAsjes this doesn't work after the upgrade to version 1.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Component-level authentication impersonation code breaks the build

5 participants