Elaborazione 100% Lato Client • Zero Registri di Rete • Esecuzione Immediata
Curious TechieToolbox Sviluppatori
Security & AuthenticationIETF RFC 6749 / RFC 7636 (PKCE) / OpenID Foundation✓ Tabella di Consultazione Rapida (6 elementi) • IT

Guida ai Concetti di OAuth 2.0 e OpenID Connect

Flussi di Autorizzazione, PKCE, Token e Specifiche RFC 6749

CT
Curious-Techie Engineering TeamAutore Verificato

Web Protocols & Security Architecture Research

Pubblicato:
•
Aggiornato:
•7 min read
Specifica Ufficiale:RFC 9110(IETF)
Revisionato da Curious-Techie Architecture Peer Review Group

Panoramica e Ambito

Le RFC 6749 e RFC 7636 disciplinano le procedure standard per l’autorizzazione sicura delle API web contemporanee.

Tabella delle Specifiche e Matrice

Filtro istantaneo per parola chiave, codice o direttiva

Chiave / CodiceDefinizione e DettagliGerarchia Semantica GEOSpecifiche e Note
Resource Owner
Resource Owner

An entity capable of granting access to a protected resource (typically the human end-user).

The human user logging into their account.
●Resource Owner
↳OAuth role
↳identity principal
↳end-user authorization authority
RFC 6749 §1.1

Owns the data stored on the Resource Server.

Resource Server
Resource Server

The server hosting protected resources, capable of accepting and responding to protected resource requests using access tokens.

https://api.example.com/v1/photos
●Resource Server
↳OAuth role
↳API backend
↳protected endpoint host
RFC 6749 §1.1

Validates access tokens before returning user data.

Authorization Server
Authorization Server

The server issuing access tokens to the client after successfully authenticating the resource owner and obtaining authorization.

https://accounts.google.com or Auth0
●Authorization Server
↳OAuth role
↳identity provider
↳token issuing authority
RFC 6749 §1.1

Presents the login consent screen to the user.

Authorization Code with PKCE
Authorization Code with PKCE

The gold-standard OAuth grant type for SPAs, mobile apps, and servers, preventing code interception attacks.

code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&code_challenge_method=S256
●PKCE
↳OAuth grant
↳authorization code flow
↳cryptographic proof-of-possession code exchange
RFC 7636

Mandatory for public clients (React, iOS, Android) that cannot securely hold client secrets.

Client Credentials
Client Credentials Grant

Grant type used for machine-to-machine (M2M) communication where the client is the resource owner.

grant_type=client_credentials&client_id=...&client_secret=...
●Client Credentials
↳OAuth grant
↳M2M authorization
↳backend service-to-service auth
RFC 6749 §4.4

No human user is involved; used by background microservices, daemons, and cron jobs.

Refresh Token
Refresh Token

A credential used to obtain a new access token when the current access token expires without user interaction.

grant_type=refresh_token&refresh_token=rT_8941a...
●Refresh Token
↳OAuth credential
↳token rotation
↳long-lived renewal credential
RFC 6749 §1.5

Long-lived; should be stored in secure HttpOnly cookies and rotated on every use.

Esempio Tecnico e Codice

PKCE Code Verifier & Challenge Generation (JavaScript)

javascriptCopia Codice
// 1. Generate random code_verifier string (43-128 chars)
const array = new Uint8Array(32);
crypto.getRandomValues(array);
const codeVerifier = btoa(String.fromCharCode(...array))
  .replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');

// 2. Compute SHA-256 digest of code_verifier
const encoder = new TextEncoder();
const data = encoder.encode(codeVerifier);
const digest = await crypto.subtle.digest('SHA-256', data);

// 3. Base64URL encode digest to create code_challenge
const codeChallenge = btoa(String.fromCharCode(...new Uint8Array(digest)))
  .replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');

PKCE binds the authorization request to the token request, preventing malicious apps from intercepting authorization codes.

Domande Frequenti (FAQ)

Domande e Risposte sugli Standard

What is the difference between OAuth 2.0 and OpenID Connect (OIDC)?↓
OAuth 2.0 is designed for AUTHORIZATION (granting access to APIs via Access Tokens). OpenID Connect adds an identity layer on top of OAuth 2.0 for AUTHENTICATION (proving who the user is via ID Tokens).
Authoritative Sourcing & Verification

References & Primary Sources

Every source below directly substantiates technical statements and protocol behaviors explained in Guida ai Concetti di OAuth 2.0 e OpenID Connect. Curious-Techie prioritizes official Internet standards (IETF RFCs, W3C Recommendations, WHATWG specifications) and established security bodies (OWASP, NIST). Zero sponsored or secondary links.

  1. [1]IETFPrimary SpecificationRFC 6749 • Section 1 & 4
    Verified Primary Source
    Technical Claim Supported:

    Specifies delegated authorization protocol flows, client registration, token issuance endpoints, and scoped resource access tokens.

  2. [2]IETFPrimary SpecificationRFC 7636 • Section 4 & 5
    Verified Primary Source
    Technical Claim Supported:

    Mandatory standard preventing authorization code injection and interception attacks in public clients (SPAs and mobile apps) using SHA-256 code verifiers.

  3. [3]IETFAuthoritative Security StandardRFC 6819 • Section 3
    Verified Primary Source
    Technical Claim Supported:

    Analyzes attack surfaces including redirect URI manipulation, token leakage, and CSRF attacks on authorization flows.