Announcements

Audio Features Endpoint not working in app

Audio Features Endpoint not working in app

srindog

Plan

Premium

Country

United States

Device

ASUS Laptop

Operating System

Windows 10

 

My Question or Issue

I am trying to hit the audio features endpoint for several tracks, however I am not getting anything back when I hit the endpoint from my app. I was getting a 401 error before but now only the headers are coming back. In my app, I am also using the getSeveralPlaylists and getPlaylistItems endpoints, which sends back the correct response. 

 

Also, I am using a refresh token to get a access token on every request. When I auth'd originally using the web-auth-examples repo, I included every scope offered in the docs. Have been printing out my url, and lined it up with the url sent in dev console. When I hit the endpoint in postman, eveything works fine with the corrected output, but only in my app nothing comes back.

 

I am using nextJs, so my frontend is calling my nextJs backend which calls the spotify web apis. In my backend, I have been using const response = await getAudioFeatures() and then { items } = response.json(). This has worked for the other endpoints above. The error that comes up is response.json() is not a function since there are no items in the response (undefined).

 

Thanks for all your help! Setup in my app is below.

 

Current setup in app (similar setup with all routes):

export const getAudioFeatures = async (ids=> {
    const { access_token } = await getAccessToken();
    return fetch(`${GET_AUDIO_FEATURES_ENDPOINT}?ids=${ids}`), {
        headers: {
            "Authorization": `Bearer ${access_token}`
        }
    }
}
 

 

 

Reply
0 Replies

Suggested posts

Env: prod