I’m building a Spotify application and need to implement search functionality to find songs by artist name. The issue is that I only have the artist’s name, not their Spotify URI.
I checked the Spotify App API documentation but couldn’t find any built-in search methods. I also tried using the web services at ws.spotify.com directly, but ran into CORS issues since they don’t support JSONP requests from client-side applications.
Has anyone found a working solution for this? What’s the best approach to implement search functionality in a Spotify app when you need to query tracks by artist name?
You’re mixing up the old Spotify App platform with the current Web API. The App platform was killed off years ago - forget about it and stick with the Web API. For client-side apps, use Authorization Code with PKCE flow to get your access tokens. Once you’re authenticated, you can hit the search endpoint directly from your frontend. No CORS headaches since Spotify’s Web API handles cross-origin requests fine when you’re properly authenticated. Get your auth flow working first. Without valid bearer tokens, you’ll keep getting authentication errors that look like CORS issues but aren’t.
Had the same CORS issue with my music app last year. Fixed it by setting up a simple Node.js proxy server that sits between your frontend and Spotify’s API. All the API calls happen server-side, so you completely bypass CORS restrictions. For search, just hit the Web API’s search endpoint with proper auth headers. The proxy also lets you handle rate limiting and errors better when you scale up.
try usin the search endpoint with an artist filter - https://api.spotify.com/v1/search?q=artist:artistname&type=track. it helped me with my CORS issues when i faced em. just make sure ur auth token is set up right!