惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
罗磊的独立博客
月光博客
月光博客
GbyAI
GbyAI
腾讯CDC
G
Google Developers Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
C
Check Point Blog
Y
Y Combinator Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
雷峰网
雷峰网
B
Blog RSS Feed
美团技术团队
M
MIT News - Artificial intelligence
有赞技术团队
有赞技术团队
D
Docker

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
The PKCE "Gotcha" in Expo’s exchangeCodeAsync
Greg · 2026-05-23 · via DEV Community
Cover image for The PKCE "Gotcha" in Expo’s exchangeCodeAsync

Greg

Setting up authentication in React Native usually leads you straight to expo-auth-session. It’s the standard for a reason—it handles the heavy lifting of browser redirects and session management so you don't have to.

But as anyone who has integrated Okta with PKCE knows, the "standard" flow usually has a few undocumented sharp edges.

While building out a recent auth flow, I hit a wall with the exchangeCodeAsync method. If you’re using PKCE (Proof Key for Code Exchange), the /authorization endpoint generates a code challenge that expects a matching code_verifier when you finally exchange your temporary code for an access token.

Here’s the catch: if you look at the Expo exchangeCodeAsync documentation (https://docs.expo.dev/versions/latest/sdk/auth-session/#authsessionexchangecodeasyncconfig-discovery),

you'll notice that the TokenRequestConfig and AccessTokenRequestConfig types don't actually include a codeVerifier key. If you try to pass it as a top-level property, the method ignores it; if you omit it, Okta (rightfully) rejects the exchange because it can't verify the original challenge.

After some digging, I found a GitHub issue from 2020 (https://github.com/expo/expo/issues/8300#issuecomment-718369087) that confirmed this has been a quiet pain point for years.

The official guides don't explicitly call it out, but the fix is actually quite simple. You have to "sneak" the verifier in using the extraParams object.

To get your tokens successfully, your request should look something like this:


    1 const tokenResult = await exchangeCodeAsync(
    2   {
    3     code: response.params.code,
    4      clientId:'my-client-id'
    5     redirectUri:'my-app-scheme://redirect'
    6     extraParams: {
    7       code_verifier: request?.codeVerifier, // The missing link
    8     },
    9   },
   10   discovery
   11 );

Enter fullscreen mode Exit fullscreen mode

By mapping the codeVerifier to extraParams (don't forget the snake case), it gets included in the POST body where Okta’s token endpoint expects it. It’s a small, one-line fix, but one of those "lost an afternoon" bugs if you’re relying solely on the official types.


Sources & Further Reading: