← Microsoft Interview Insights

Microsoft·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
May 2026

Summary

Did a system design and technical discussion round at Microsoft covering OOP principles and browser authentication end-to-end. Two pretty meaty topics back to back, and I felt more confident on one than the other.

Questions Asked (3)

Q1

Walk through how you would design class structures and assign responsibilities in an object-oriented system. How do you decide what goes in an interface versus a concrete class?

System DesignTechnical Trade-offs
Author's notes

I started with interfaces and worked down, which felt right, but I fumbled when they pushed on how I'd handle shared behavior across classes that don't share a parent.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem domain and requirements, then apply the Single Responsibility Principle to assign responsibilities to classes. Use interfaces to define contracts for behavior that may have multiple implementations or needs to be mocked, and concrete classes for specific implementations with state and logic.

Pro tip: Emphasize that interfaces should be designed from the client's perspective, focusing on what the client needs, not on how the implementation works. This shows you understand the Dependency Inversion Principle and API design.

1. Understand Requirements and Domain

Identify the core entities, their behaviors, and the interactions between them. Consider current and future needs to avoid over-engineering.

2. Apply SOLID Principles

Use Single Responsibility to assign one reason to change per class, and Interface Segregation to keep interfaces focused. Favor composition over inheritance for flexibility.

3. Decide Interface vs Concrete Class

Use interfaces to define contracts for behaviors that may vary or need multiple implementations. Use concrete classes for specific implementations with state and logic that are unlikely to change.

4. Iterate and Refactor

Start with concrete classes if unsure, and refactor to interfaces when patterns emerge. Validate design with unit tests and mockability.

Key Points to Mention

  • Single Responsibility Principle: each class should have one reason to change.
  • Interface Segregation Principle: clients should not depend on interfaces they don't use.
  • Dependency Inversion Principle: depend on abstractions, not concretions.
  • Use interfaces for polymorphic behavior and to enable mocking in tests.
  • Concrete classes encapsulate state and implementation details.
  • Avoid over-abstraction: introduce interfaces when there's a clear need, such as multiple implementations or external dependencies.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Explain how authentication works in the browser from start to finish, including cookies versus tokens, session management, and OAuth/OIDC flows.

System DesignAPI & IntegrationsTechnical Trade-offs
Author's notes

This one I actually felt okay about.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Structure your answer as a narrative journey of a user authenticating, starting from the initial request and ending with authorized access. Compare and contrast cookies vs tokens and session vs stateless approaches, then explain OAuth/OIDC flows as a standardized way to delegate authentication. Emphasize trade-offs and real-world considerations like security and scalability.

Pro tip: Tie your explanation to Microsoft's ecosystem (e.g., Azure AD, MSAL) and highlight security best practices like token validation and secure cookie attributes to show practical maturity.

1. Initial Authentication

Describe how a user submits credentials (e.g., username/password) to the server, which verifies them against a user store.

2. Session Establishment

Explain how the server creates a session and returns a session ID (stored in a cookie) or a token (e.g., JWT) to the client.

3. Subsequent Requests

Detail how the browser automatically includes cookies or the client attaches tokens in headers for each request, and how the server validates them.

4. OAuth/OIDC Flows

Introduce OAuth 2.0 for authorization and OIDC for authentication, explaining common flows like authorization code with PKCE and how tokens (access, ID, refresh) are used.

5. Trade-offs and Best Practices

Compare cookies vs tokens (e.g., CSRF vs XSS, scalability) and discuss security measures like HTTPS, HttpOnly, SameSite, and token expiration.

Key Points to Mention

  • Cookies: server-side session storage, automatic inclusion, CSRF risks, HttpOnly and SameSite attributes.
  • Tokens: stateless JWTs, client-side storage, scalability, XSS risks, and token revocation challenges.
  • Session management: session IDs, expiration, refresh tokens, and sliding sessions.
  • OAuth 2.0 vs OIDC: OAuth for authorization, OIDC for authentication, ID token vs access token.
  • OAuth flows: authorization code with PKCE for SPAs, client credentials for server-to-server.
  • Security best practices: HTTPS, secure cookie flags, token validation, and using libraries like MSAL.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

What are the security risks of storing tokens in the browser, and how do cookie attributes like HttpOnly, Secure, and SameSite help mitigate CSRF and XSS attacks?

System DesignTechnical Trade-offs
Author's notes

Got into the XSS versus CSRF distinction and I think I had it right but I was second-guessing myself mid-answer.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by outlining the security risks of storing tokens in the browser, focusing on XSS and CSRF. Then explain how cookie attributes like HttpOnly, Secure, and SameSite mitigate these risks, and discuss trade-offs between different storage mechanisms.

Pro tip: Emphasize that while HttpOnly cookies prevent XSS token theft, they don't eliminate XSS entirely; combining with other defenses like CSP and input sanitization is crucial. Also, mention that SameSite helps with CSRF but consider its limitations with older browsers.

1. Identify token storage options

Discuss common storage locations: localStorage, sessionStorage, and cookies. Highlight that localStorage/sessionStorage are accessible via JavaScript, making them vulnerable to XSS.

2. Explain XSS and CSRF risks

Define XSS (malicious script injection) and CSRF (forced authenticated requests). Explain how tokens in JavaScript-accessible storage can be stolen via XSS, and how cookies are automatically sent, enabling CSRF.

3. Describe cookie attributes and their mitigations

Explain HttpOnly (prevents JavaScript access, mitigating XSS token theft), Secure (ensures transmission over HTTPS, preventing MITM), and SameSite (restricts cross-site sending, mitigating CSRF).

4. Discuss trade-offs and best practices

Compare cookie-based vs. token-based auth. Note that HttpOnly cookies are not immune to all XSS (e.g., CSRF via XSS), and SameSite may not cover all cases. Recommend layered security: CSP, CSRF tokens, and proper CORS.

Key Points to Mention

  • XSS can steal tokens from localStorage/sessionStorage because they are accessible via JavaScript.
  • HttpOnly cookies prevent JavaScript access, reducing XSS token theft.
  • Secure attribute ensures cookies are only sent over HTTPS, preventing man-in-the-middle attacks.
  • SameSite attribute (Strict/Lax) mitigates CSRF by controlling cross-site cookie sending.
  • CSRF attacks exploit automatic cookie sending; SameSite and CSRF tokens are key defenses.
  • No single mitigation is perfect; defense-in-depth is essential (e.g., CSP, input validation).

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.