Przejdź do treści

Komunikacja Frontend-Backend

REST API

Frontend → Backend przez HTTP/HTTPS

Flow

Component
  ↓ dispatch action
NGXS Action
  ↓ calls
API Service (Angular)
  ↓ HTTP request
Controller (ASP.NET)
  ↓ calls
Service Layer
  ↓ calls
Repository
  ↓ query
Database

Autentykacja

Azure AD B2C JWT tokens: 1. User loguje się 2. Azure zwraca JWT 3. Frontend dodaje token do headers 4. Backend waliduje token

Przykład

Frontend:

this.http.get('/api/budgets', {
  headers: { Authorization: `Bearer ${token}` }
})

Backend:

[Authorize]
[HttpGet]
public async Task<IActionResult> GetBudgets() {...}

Zobacz Integracje