-
Notifications
You must be signed in to change notification settings - Fork 44
feat: implement headless authentication API #1962
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add ConnectOptions interface with username and authMethod
- Extend connect() method to infer headless mode from parameters
- Update Keychain interface to support headless connection requests
- Add HeadlessConnect component for programmatic authentication
- Modify Home component to handle headless flows
- Maintain full backward compatibility with existing modal flow
- Add comprehensive documentation and examples
This allows applications to authenticate users programmatically without
displaying the modal interface by providing username and authMethod:
await controller.connect({
username: 'alice',
authMethod: 'metamask'
});
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Implement MetaMask, Rabby, and WalletConnect headless authentication - Add proper signup/login flow detection and handling - Use existing authentication hooks for consistent behavior - Add clear error messages for unsupported methods (WebAuthn, social) - Create HeadlessAuth example component in Next.js app - Maintain backward compatibility with existing modal flow Supported headless methods: - metamask: External wallet connection - rabby: External wallet connection - walletconnect: Cross-platform wallet protocol Note: WebAuthn and social logins require user interaction and are not supported in headless mode. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
….js example - Fix incorrect @cartridge/ui component imports to use main export - Use ControllerConnector.fromConnectors pattern for headless auth - Remove unused connect variable to resolve linting error 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
06bd800 to
af0538b
Compare
Fixes TypeScript compilation error by importing useConnection from @/hooks/connection 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Updated HeadlessConnect component to use handleSubmit from useCreateController - Fixed issue where controller wasn't being created after MetaMask authentication - Removed unused imports and simplified the authentication flow - Controller is now properly set on window object after successful auth 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
| address: controller.address(), | ||
| }); | ||
| } | ||
| }, [controller, context]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Race Condition in Context Resolution
The component has two useEffect hooks that can independently resolve the ConnectCtx promise: one for handleHeadlessAuth errors and another for controller availability. This creates a race condition, potentially resolving the context prematurely or incorrectly, bypassing the intended authentication flow.
Summary
connect()method to infer headless mode when bothusernameandauthMethodare providedKey Changes
connect()method with optionalConnectOptionsparameterConnectOptionsinterface and updatedKeychaininterfaceHeadlessConnectcomponentAPI Usage
Test Plan
connect()calls work unchangedImplementation Status
✅ Core infrastructure and API design complete
🚧 Individual auth method implementations need completion in
HeadlessConnectcomponent🤖 Generated with Claude Code