Authentication π
The users Collection Contract
users Collection Contract1. Sign Up User
await fetch('https://api.ub.bitbros.in/api/userAuth/signup', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' },
body: JSON.stringify({
email: "[email protected]",
password: "securePassword123",
username: "dev_pulse",
preferences: { theme: "dark", notifications: true } // Custom fields are supported!
})
});2. Login User
3. Refresh Access Token
4. Logout
5. Get Profile (Me)
6. Get Public Profile by Username
Security Note
How this relates to RLS and pk_live
pk_liveRLS Quick Test (2 minutes)
1) pk_live + no token => write should fail
pk_live + no token => write should fail2) pk_live + user token + no userId => write should pass, owner auto-injected
pk_live + user token + no userId => write should pass, owner auto-injected3) pk_live + user token + different userId => write should fail
pk_live + user token + different userId => write should fail4) sk_live (server side) => bypass allowed
sk_live (server side) => bypass allowedLast updated
