Skip to content
_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN DE
Let's talk

OAuth 2.0 — A Complete Guide to Flows

22. 07. 2024 Updated: 27. 03. 2026 1 min read intermediate

OAuth 2.0 allows applications to access user resources without sharing the password. Google Login, GitHub Login — that is OAuth.

Flows

  • Authorization Code + PKCE: Web and mobile (recommended)
  • Client Credentials: Machine-to-machine
  • Device Authorization: TV, IoT
  • Implicit (DEPRECATED): Do not use

Authorization Code + PKCE

import hashlib, base64, secrets code_verifier = secrets.token_urlsafe(64) code_challenge = base64.urlsafe_b64encode( hashlib.sha256(code_verifier.encode()).digest() ).rstrip(b’=’).decode()

Exchange code for tokens

token = requests.post(“https://auth.example.com/token”, data={ “grant_type”: “authorization_code”, “code”: authorization_code, “client_id”: “myapp”, “code_verifier”: code_verifier, }).json()

Client Credentials

token = requests.post(“https://auth.example.com/token”, data={ “grant_type”: “client_credentials”, “client_id”: “service-a”, “client_secret”: “secret”, “scope”: “api.read”, }).json()

Key Takeaway

Auth Code + PKCE for web/mobile, Client Credentials for M2M. Always validate state, short token expiration.

securityoauthautentizaceapi
Share:

CORE SYSTEMS team

We build core systems and AI agents that keep operations running. 15 years of experience with enterprise IT.