Announcements

Help Wizard

Step 1

NEXT STEP

Problem with Spotify OAuth 2.0 + PKCE in React Native (Expo) – INVALID_CLIENT: Invalid redirect URI

Problem with Spotify OAuth 2.0 + PKCE in React Native (Expo) – INVALID_CLIENT: Invalid redirect URI

Environment

  • Devices: iPhone 14 Simulator, iPhone 14 Pro (Real Device)
  • OS Versions: iOS 16.4, iOS 18.3.2
  • Framework: React Native (with Expo)
  • Auth Library: expo-auth-session
  • Authorization Flow: Authorization Code Flow with PKCE enable

 

Problem Description

I'm implementing Spotify OAuth 2.0 with PKCE in a React Native (Expo) app using expo-auth-session.

When usePKCE is set to false, everything works perfectly — the Authorization Code Flow without PKCE works as expected, and I can successfully log in.

However, as soon as I switch to PKCE (usePKCE: true), I encounter this error:

 

INVALID_CLIENT: Invalid redirect URI
HTTP 400 Bad Request status_text: (empty)

 

What I've Checked

  • My redirect URIs are correctly registered in the Spotify Developer Dashboard
  • I’ve debugged with WebView on both simulator and real device — nothing helpful surfaced.
  • I’ve manually generated and tested code_verifier and code_challenge, following the PKCE specs.
  • Authorization Code Flow without PKCE works flawlessly.

Questions

  • Has anyone successfully implemented Spotify OAuth 2.0 + PKCE in a React Native (Expo) app using expo-auth-session?
  • Could this be an issue with how Spotify handles PKCE with custom redirect URIs?
  • Is there anything specifically required by Spotify for PKCE to work that might be undocumented?

Thanks in advance!

If anyone has encountered this issue or found a working configuration for PKCE + Spotify + Expo, your input would be greatly appreciated!

Reply
0 Replies

Suggested posts

Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

ModeratorStaff / Moderator/ 4 years ago  in Social & Random