Spotify api returning incorrect us aer access token after apple login
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Plan
Free/Premium
Country
Canada
Device
iphone 16, M3 pro
Operating System
IOS, MacOS
My Question or Issue
Hi everyone,
I’m running into a strange issue with Spotify OAuth in my Next.js app. The flow works perfectly when logging into Spotify with a regular username and password. However, when logging in via Apple or Google, the Spotify auth seems to succeed, but the page either crashes or shows a blank screen. On Vercel, I see the following error in the logs:
TypeError: Body is unusable: Body has already been read
at c (.next/server/app/api/callback/route.js:1:1837)
while the client reads:
{"error": "invalid grant"
, "error_description"
: " In
valid authorization code"}}
i think it has something to so with
Authorization codes being reused or becoming invalid
Something different in the redirect URL Spotify sends when using Apple/Google login
Cookie/session state mismatch
I’ve verified that:
The code param is being received from Spotify
The app works fine when logging in the standard way
I’m not re-reading the response body more than once
Any ideas what could cause this issue when using Spotify login via Apple or Google specifically?
Would really appreciate any insight or suggestions. Ive attached images of the callback route.
Thanks in advance!
- Labels:
-
API Access
-
API Key



- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page