my-appengineer Courses

Accounts, login and roles

Build the coreLesson20 min6 / 20

Every app the my-app.engineer builder makes comes with authentication: the blueprint row Authentication & accounts is always included, with login, sessions and password reset. That saves you the riskiest part of the work. But "people can log in" is not the same as "the right people see the right data". In this lesson you decide who can do what in Bookwise, ask the builder for exactly that, and test it like an attacker would.

Authentication versus authorisation

Two words that are easy to mix up:

  • Authentication: who are you? Email and password, a session cookie, a reset link. The platform includes this.
  • Authorisation: what may you do? Which salon's data you may see, whether you may change prices, whether you may cancel someone else's appointment. This is your design, and the builder can only build what you describe.

Most data leaks in small SaaS products are authorisation bugs, not broken passwords.

Step 1: write the permission matrix

List your roles and your main actions in a table. For Bookwise:

ActionOwnerStaffClient (no account)
Create and edit the salonYesNoNo
Manage services and pricesYesNoNo
Invite and deactivate staffYesNoNo
See all appointments of the salonYesOwn onlyNo
Create or move an appointmentYesOwn onlyVia booking page
Cancel an appointmentYesOwn onlyVia email link, until 24 h before
Manage the subscription and billingYesNoNo
See client contact detailsYesOwn clientsOwn only

Every "Yes" is a rule the server must check. Every "No" is a request the server must refuse, even if someone crafts it by hand.

Tip

Keep roles few. Two roles (owner and staff) plus an anonymous client cover the Bookwise MVP. A third role such as "receptionist" can come when a paying salon asks for it.

Step 2: invitations, not shared passwords

Salons often share one login among all staff. Do not design for that. Instead:

  1. The owner enters a staff member's email.
  2. The app sends an invitation email with a single-use link that expires (for example after 72 hours).
  3. The staff member sets their own password and is linked to the salon through a membership with role staff.
  4. When someone leaves, the owner deactivates the membership; the person's login no longer opens this salon.

This is also why the data model uses a memberships table.

Step 3: ask the builder for it

Go back to your build's manager chat (open your app's build from the dashboard, or #/app/<app-name> in the builder) and ask for the roles in one precise message.

Add roles and permissions to Bookwise:
- Roles per salon: owner and staff (stored on memberships).
- The user who creates a salon becomes its owner.
- Owners can invite staff by email; the invite link is single-use and
  expires after 72 hours. Owners can deactivate staff.
- Staff see and edit only appointments where they are the staff member.
- Only owners manage services, prices, staff and billing.
- Every server endpoint checks the logged-in user's membership and role
  for the salon of the record it reads or changes. Never trust a salon_id
  or staff_id sent by the browser without that check.
- Return 404 (not 403) for records of another salon, so their existence
  is not revealed.

Each change is a new build against the same app. Wait for it to finish and look at the live preview.

Step 4: test it like an attacker

Create test data:

  • Salon A with owner owner-a@... and staff staff-a@...
  • Salon B with owner owner-b@...

Use test addresses you control (many mail providers support you+owner-a@yourdomain style aliases). Then try to break your own rules:

  1. Log in as owner B and open an appointment URL of salon A (copy the id from salon A's screen). You must get "not found".
  2. Log in as staff A and try to open the services settings by typing the URL. You must be refused.
  3. As staff A, try to edit an appointment of another staff member.
  4. Log out and open a protected page directly. You must land on the login page.
  5. Use an invitation link twice. The second time must fail.
  6. Request a password reset for an address that does not exist. The app must not reveal that it does not exist.
Watch out

A button that is hidden in the menu is not a permission. Always test by typing the URL or replaying the request, not only by clicking around. If test 1 shows salon A's data, stop and fix it before anything else: this is the bug that ends small SaaS companies.

Step 5: let Claude review the authorisation code

With the Claude connector (Read files permission) Claude can read code in your workspace. Where your builder app's code lives depends on how you work: the app's repo is reachable from the App hub. If the code is in your workspace, ask Claude for a read-only review.

Ask Claude
Use my my-app.engineer workspace. Do not change anything. Review the server code of [app name] for authorisation:
1. List every endpoint or server action that reads or changes salon data.
2. For each, say whether it checks (a) that the user is logged in, (b) that the user is a member of the salon of that record, (c) the role required by this matrix: [paste your permission matrix].
3. Flag every place where a salon_id, staff_id or user id from the request is trusted without that check.
Answer as a table, most dangerous findings first.

Password and session hygiene

The platform includes login, sessions and password reset; check a few basics in your app anyway:

  • passwords are hashed (never stored or emailed in plain text);
  • the reset link is single-use and expires;
  • login has some form of rate limiting or lockout after repeated failures;
  • sessions expire after inactivity and on logout;
  • the session cookie is HttpOnly and Secure (your app runs on HTTPS).

If you are unsure how your app handles one of these, ask Claude to find the code and explain it, then ask the builder to fix gaps.

How it works in your country

B2B customers increasingly ask about security and data protection before they buy. In the EU, GDPR requires appropriate technical measures, which includes access control. National regulators publish practical guidance: for example the Autoriteit Persoonsgegevens (Netherlands), CNIL (France), UODO (Poland) or the ICO (UK). Check the guidance for your country.

Bookwise

Test 1 failed on the first try: owner B could open salon A's appointment detail page by its id. The founder sent the manager one message ("Every appointment endpoint must check the user's membership for the appointment's salon; return 404 otherwise"), waited for the build, and ran all six tests again. All passed. The founder now runs these six tests after every build that touches appointments.

Your task

Write your permission matrix, ask the builder for roles in one precise message, create two test salons and run the six attack tests. Write the results in your change log.

This course is general information, not personal legal, tax or financial advice. Rules, amounts and dates change: check the official source for your country before you act.