0Pricing
Spring Security 6 & JWT Authentication · Ders

PKCE ve Genel İstemcileri Güvenceye Alma

Bir istemci gizli bilgisini saklayamayan mobil ve tek sayfalı uygulamalarda PKCE uzantısının OAuth2 Authorization Code akışını nasıl koruduğunu öğrenin.

PKCE ve Genel İstemcileri Güvenceye Alma, CoddyKit'te ücretsiz bir Spring Security 6 & JWT Authentication dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Spring Security 6 & JWT Authentication öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Spring Security 6 & JWT Authentication kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

The Public Client Problem

Mobile apps and SPAs are public clients: their code ships to the user, so they cannot safely store a client secret. Without a secret, the plain Authorization Code flow is vulnerable to interception.

What PKCE Solves

PKCE (Proof Key for Code Exchange, pronounced 'pixy') adds a dynamic secret per authorization request. Even if the authorization code is stolen, it cannot be exchanged without the matching proof.

The Code Verifier

The client generates a random, high-entropy string called the code_verifier and keeps it in memory for this one flow.

const codeVerifier = base64url(randomBytes(32));

The Code Challenge

The client hashes the verifier with SHA-256 to make the code_challenge. The hash is sent to the server, but the original verifier never leaves the device yet.

const codeChallenge = base64url(sha256(codeVerifier));

Starting the Authorization Request

The client sends the challenge and the method (S256) to the authorization endpoint along with the usual parameters.

GET /authorize?response_type=code
  &client_id=app123
  &code_challenge=XYZ...
  &code_challenge_method=S256

Server Stores the Challenge

The authorization server remembers the code_challenge and links it to the authorization code it issues after the user logs in.

Exchanging the Code

When swapping the code for tokens, the client now reveals the original code_verifier.

POST /token
  grant_type=authorization_code
  &code=abc123
  &code_verifier=ORIGINAL_RANDOM

Server Verifies the Proof

The server hashes the received verifier and compares it to the stored challenge. If they match, the requester is the same party that started the flow; otherwise it rejects the exchange.

if (sha256(received_verifier) !== stored_challenge) {
  reject('invalid_grant');
}

Why It Stops Interception

An attacker who steals the authorization code (for example via a malicious app on the device) still cannot use it: they never saw the code_verifier, which existed only inside the legitimate client's memory.

PKCE Is Now Recommended for All

Originally for mobile, PKCE is now recommended for every Authorization Code flow, including confidential web clients. OAuth 2.1 makes it the default.

Library Support

You rarely implement PKCE by hand. Libraries like AppAuth, oidc-client-ts, and Spring Authorization Server handle verifier generation, hashing, and validation for you.

Quick Check

Test your understanding of PKCE.

Recap

You learned how PKCE secures public clients:

  • Public clients cannot keep a secret, so the plain code flow is unsafe
  • The client creates a code_verifier and sends its hash as the code_challenge
  • The verifier is revealed only at token exchange
  • A stolen code is useless without the verifier

PKCE is now the default for all Authorization Code flows.

Sıkça Sorulan Sorular

“PKCE ve Genel İstemcileri Güvenceye Alma” dersi ücretsiz mi?

Evet — “PKCE ve Genel İstemcileri Güvenceye Alma” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Spring Security 6 & JWT Authentication kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Spring Security 6 & JWT Authentication kursu toplamda 4 dersten oluşur.

“PKCE ve Genel İstemcileri Güvenceye Alma” dersinde ne öğreneceğim?

Bir istemci gizli bilgisini saklayamayan mobil ve tek sayfalı uygulamalarda PKCE uzantısının OAuth2 Authorization Code akışını nasıl koruduğunu öğrenin. Spring Security 6 & JWT Authentication ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Spring Security 6 & JWT Authentication öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Spring Security 6 & JWT Authentication, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.

“PKCE ve Genel İstemcileri Güvenceye Alma” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Spring Security 6 & JWT Authentication dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Spring Security 6 & JWT Authentication dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. OAuth2 protokolüne genel bakış
  2. OpenID Connect'e giriş
  3. Yaygın OAuth2 izin türleri
  4. PKCE ve Genel İstemcileri Güvenceye Alma
← Spring Security 6 & JWT Authentication Sayfasına Dön