Skip to content

Instantly share code, notes, and snippets.

@jaylandro
Created May 28, 2025 16:51
Show Gist options
  • Save jaylandro/30080eeac64fa763b63f880cf8a06b43 to your computer and use it in GitHub Desktop.
Save jaylandro/30080eeac64fa763b63f880cf8a06b43 to your computer and use it in GitHub Desktop.
sequenceDiagram
    participant Client
    participant Server
    participant Database

    Client->>Server: Send login credentials
    Server->>Database: Validate credentials
    Database-->>Server: Return user info (if valid)
    alt Credentials valid
        Server->>Server: Generate JWT
        Server-->>Client: Return JWT
        Client->>Server: Send request with JWT (Authorization header)
        Server->>Server: Verify JWT signature & claims
        alt JWT valid
            Server-->>Client: Return protected resource/data
        else JWT invalid/expired
            Server-->>Client: Return 401 Unauthorized
        end
    else Credentials invalid
        Server-->>Client: Return authentication error
    end
Loading
@jaylandro
Copy link
Author

jaylandro commented May 28, 2025

sequenceDiagram
    participant Client
    participant Server
    participant Database

    rect rgba(191, 223, 255, 0.5)
    Client->>+Server: Send login credentials
    Server->>+Database: Validate credentials
    Database-->>-Server: Return user info (if valid)
    Server-->>-Client: Return user info or authentication error
    end

    alt Credentials valid
        Server->>Server: Generate JWT
        Server-->>-Client: Return JWT

        rect rgba(200, 150, 255, 0.4)
        Client->>+Server: Send request with JWT (Authorization header)
        Server->>Server: Verify JWT signature & claims
        alt JWT valid
            Server-->>-Client: Return protected resource/data
        else JWT invalid/expired
            Server-->>-Client: Return 401 Unauthorized
        end
        Client-->>-Server: Acknowledge receipt
        end
    else Credentials invalid
        Server-->>-Client: Return authentication error
    end
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment