AuthResource
Access via urblock.auth.
Authentication flows for end users — registration, login, SIWE (Sign-In with Ethereum), passkey challenges, token refresh, and profile management.
Methods
register(params)
Register a new end-user account.
const result = await urblock.auth.register({
email: "user@example.com",
password: "SecurePass1!",
});
Returns: AuthResponse
login(params)
Authenticate with email/password.
const session = await urblock.auth.login({
email: "user@example.com",
password: "SecurePass1!",
});
console.log(session.access_token);
Returns: AuthResponse
siweNonce()
Get a SIWE nonce for Sign-In with Ethereum.
const { nonce } = await urblock.auth.siweNonce();
Returns: { nonce: string }
passkeyChallenge()
Get a WebAuthn challenge for passkey authentication.
const challenge = await urblock.auth.passkeyChallenge();
Returns: PasskeyChallengeResponse
unified(params)
Unified authentication endpoint — resolves to the correct flow based on provided credentials.
const result = await urblock.auth.unified({
method: "passkey",
credential: { /* WebAuthn assertion */ },
});
Returns: AuthResponse
refresh(params)
Refresh an access token using a refresh token.
const newTokens = await urblock.auth.refresh({
refresh_token: "rt_...",
});
Returns: AuthResponse
logout()
Invalidate the current session.
await urblock.auth.logout();
me()
Get the current user's profile.
const profile = await urblock.auth.me();
console.log(profile.email, profile.id);
Returns: UserProfileResponse
updateProfile(params)
Update the current user's profile.
await urblock.auth.updateProfile({
display_name: "Alice",
});
Returns: UserProfileResponse