auth.yourcompany.com) while leveraging the Squads API to proxy WebAuthn requests to the blockchain.
Primary Use Case: Custom Domain - Host passkey authentication on your own domain instead of the default Squads domain for branding, compliance, or security requirements.
When to Use Advanced Integration
Choose this approach when you need:- Custom Domain: Host passkey flows on
auth.yourcompany.cominstead ofpasskey.grid.squads.xyz - Compliance Requirements: Internal policies require authentication to happen on company domains
- Brand Consistency: Maintain your brand throughout the entire authentication flow
- Security Policies: Security requirements mandate own domain usage
How It Works
WebAuthn Proxy Flow
- Create Session: Use the auth endpoint with your custom
baseUrl - Extract Challenge: Parse the challenge from the returned URL
- WebAuthn Ceremony: Implement WebAuthn protocol on your domain with proper ES256 support
- Submit Response: Use the submit-passkey-session endpoint to process the response
- Get Account: Retrieve the account using the externally-signed-account endpoint
Custom UI Requirements
When implementing a custom passkey UI, your implementation must:- Extract the challenge: Parse the
challengeparameter from the URL - Use challenge directly: Pass the challenge to the WebAuthn protocol as-is (already base64 encoded)
- Do NOT re-encode: The challenge is already base64 encoded - additional encoding will cause errors
- Return complete response: For authentication, return the entire WebAuthn authentication response object
- Time constraint: The challenge is only valid for 60 seconds from URL generation
Advanced API Endpoints
For custom UI implementations, use these advanced endpoints:- Submit Passkey Session - Process WebAuthn responses
- Get Externally Signed Account - Retrieve account from response
- Get Account Data - Get detailed account information
MetaInfo and BaseURL Usage
Default vs Custom BaseURL
- Default baseUrl: When using the default
https://passkey.grid.squads.xyz, themetaInfofields are used by the hosted UI - Custom baseUrl: Use your custom domain (e.g.,
https://auth.yourcompany.com) - your UI handles passkey identification and naming
Example Configuration
WebAuthn Configuration Requirements
Required Settings
The on-chain passkey program has specific requirements: User Presence Required:userPresentmust betruein the WebAuthn authenticator response- The authenticator must verify user presence through biometric, PIN, or physical interaction
- Only ES256 (algorithm
-7) is supported - No other cryptographic algorithms are accepted
Error Handling
Common Errors
| Error Code | Description | Solution |
|---|---|---|
InvalidNetwork | Operation not supported on mainnet | Use devnet |
MissingSessionKey | Session key required for auth actions | Provide valid session key |
InvalidAuthenticatorResponse | Malformed WebAuthn response | Validate WebAuthn data |
NoValidExternallySignedAccount | Account not found | Verify account exists |
Registration Failure Recovery
If local passkey creation succeeds but submission fails:- The passkey exists locally but has no associated on-chain account
- Solution: Re-request a new URL with
action: "create"and submit again - The existing local passkey will work with the new challenge
- No need to recreate the local passkey
Best Practices
Challenge Handling
- Parse challenge from URL parameters
- Use challenge directly - it’s already base64 encoded
- Never re-encode the challenge
- Complete WebAuthn ceremony within 60 seconds of URL generation
Security
- Validate all inputs
- Use HTTPS for all communications
- Implement proper CORS policies
- Never expose API keys in client-side code
- Store session keys securely on client side
Implementation
- Generate unique session keys for each authentication
- Implement comprehensive error handling
- Provide user-friendly error messages
- Use clear, recognizable app names
- Provide loading states during authentication
Getting Started
- Review Requirements: Ensure you have WebAuthn expertise and need company URL branding
- Set Up Domain: Configure your company domain for passkey flows
- Implement WebAuthn: Build custom UI following the requirements above
- Test on Devnet: Thoroughly test your implementation before production
- Handle Errors: Implement robust error handling and recovery