The CWA is in heavy development
The CWA is still in alpha and not ready for production - some code and implementations are likely to change. If you would like to try out the CWA, please enjoy what we have provided and feel free to provide feedback, or get involved on GitHub.
DraftCwa Api
cwa.auth
Authentication state and all user account actions — sign in, sign out, password reset, and email verification.
Authentication state and all user account actions.
State
cwa.auth.signedIn // ComputedRef<boolean>
cwa.auth.user // ComputedRef<CwaUser | undefined>
cwa.auth.roles // ComputedRef<string[]>
cwa.auth.isAdmin // ComputedRef<boolean> — true for ROLE_ADMIN or higher
cwa.auth.status // ComputedRef<CwaAuthStatus> (0=SIGNED_OUT, 1=LOADING, 2=SIGNED_IN)
cwa.auth.hasRole('ROLE_ADMIN') // boolean — check a specific role
Actions
// Sign in with username/password
const result = await cwa.auth.signIn({ username: 'alice@example.com', password: 'secret' })
if (result instanceof FetchError) {
console.error('Login failed', result.statusCode)
}
// Sign out
await cwa.auth.signOut()
// Request a password reset email
await cwa.auth.forgotPassword('alice@example.com')
// Complete a password reset (from link parameters)
await cwa.auth.resetPassword({
username: 'alice',
token: 'abc123',
passwords: { first: 'new_password', second: 'new_password' }
})
// Verify email address (from link parameters)
await cwa.auth.verifyEmail({ username: 'alice', token: 'abc123' })
// Confirm email address change (from link parameters)
await cwa.auth.confirmEmail({ username: 'alice', token: 'abc123', newEmail: 'new@example.com' })
// Re-send verification email
await cwa.auth.resendVerifyEmail('alice')
await cwa.auth.resendVerifyNewEmail('alice')
// Re-hydrate user from the /me endpoint (e.g. after updating profile)
await cwa.auth.refreshUser()