M. Kodirov

STAGE 03 / LESSON 04

Validation, authorization and errors

Every request crosses a trust boundary, even when it comes from your own frontend.

THE IDEA

Understand it.

Validate input type, length and permitted values on the server. Authentication establishes who is making a request; authorization decides whether that identity may perform the requested action on a particular resource.

Return useful, consistent error responses without exposing secrets or internal stack traces. A valid task identifier is not permission to view another user’s task.

SEE IT IN CONTEXT

A safe decision flow

Request → authenticate user
        → validate task input
        → authorize access to this task
        → execute operation
        → return a safe response

Client-side validation improves feedback; it cannot replace server-side validation or authorization.

LEARN FROM REAL WEBSITES

See it in the real world.

These simplified structures come from public sources. Company systems change, and the sources may describe only one project or an earlier design.

GitHub

Documentation checked November 2026

Limit app access

GitHub Apps request specific permissions for resources and operations instead of receiving unrestricted access by default.

  1. GitHub App
  2. Requested permission
  3. Allowed resource operation

What to learn: Authorization is a server-side boundary. Input validation and clear errors are separate responsibilities to add in your own API.

Read the source: GitHub App permissions

Spotify

Documentation checked November 2026

Ask for the right scope

Spotify's Web API uses scopes to describe which protected user resources an application may access.

  1. Application
  2. Requested scope
  3. Protected API operation

What to learn: A valid request can still be denied when it lacks permission; validate input separately from checking authorization.

Read the source: Spotify authorization scopes

TRY IT YOURSELF

Practice.

A signed-in user requests another employee’s private task by changing its URL. What must the server check?

Show one possible answer

It must check authorization for that specific task and action, not merely that the user is signed in or that the task ID exists.

GO DEEPER

Official references.