Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Spotify API doesn't give access to people even after Quota Extension

Solved!

Spotify API doesn't give access to people even after Quota Extension

My Question or Issue

 

I recently made a small web application using the Spotify API. The app was made in the relatively newly announced development mode. After I finished making the app, I added a few people to the Users and Access list. It worked fine. As I wanted unlimited users to use it, I requested a quota extension. It was approved and the Users and Access tab became grey.

BUT, the problem which arose was that ONLY the people I added in the Users and Access list can access the website even now after the request was approved. If someone not on the list accesses the website, the whole website crashes as Spotify doesn't give access to that person. I can't even edit the Users and Access list as its greyed out. I don't understand what's going on.

 

Someone, please help me out in this

 

https://graphin-tunes.herokuapp.com/ - Here's the website.

 

Reply

Accepted Solutions
Marked as solution

From the screenshot you linked this isn't a case of the APIs not working or giving errors for the specific user - it's because there is no data for recently played for that specific user. This could be caused by a number of things such a private sessions or simply that you are using a test user that has no listening history?

View solution in original post

11 Replies

Hi there

 

I'm sorry to hear you're experiencing issues after getting your quota extension request approved. I have just tried to log in to your app to see if I could get a read on some errors but the app crashed. 

 

Can you provide some more details? You must be seeing some errors somewhere from the Spotify APIs? Typically this should manifest itself with HTTP 403 "User not approved for app" error. Can you give some more details?

So I checked the logs of this error, and the problem which unfolds is that the data is undefined. The app tries to access a property of an undefined object, hence the app shuts down gracefully.  I also checked the headers associated and the status code which arises is 503 Service Unavailable.

This only happens for users I had not added to the Users and Access list before the quota extension was approved.

Also, another thing is that when a new user logs in onto the website, Spotify logs the user in, however doesn't send the data requested to my application, hence causing it to crash.

I've had the team check the app from our end and everything seems to be working as expected. I also just logged in with my own user to your app which worked fine - and I wasn't added to your app prior to your extension request 😉 

 

I can't really give much insights into your app and the crash but it sounds like you need to handle errors more gracefully so it doesn't completely crash?

 

In order to help troubleshoot further we need to know exactly what APIs you're calling and what errors/data you're getting from them. You mention "however doesn't send the data requested to my application" - can you elaborate on this? Which APIs are you calling and what's the result? Any errors? What was the expected result?

Yes, I need to improve my error handling, because it is pretty terrible right now😅.

 

I am calling the Web API and this is the error I get from the logs:

 TypeError: Cannot read property 'name' of undefined

 So it seems that Spotify does log the new user in, but doesn't send any data back to the client. The status code I receive on the app is "503 Service Unavailable". 

When I log in using one of the users I added prior to the extension, I receive an array, each element of that array is an object having all the audio features. I don't think it's an issue related to the code, as the website loads perfectly for added users. I am also unsure whether the problem arises on my part or if it is a bug in the API?

 

For me, it still seems to crash when I log in as a new user.😥

Okay, so this error

 TypeError: Cannot read property 'name' of undefined

 Is coming from your application, not the Web API.

 

Which API (URL) are you calling? Basically I'm trying to figure out which API calls you're making to the Spotify Web API and what errors you're getting from the Web API

I am using the Spotify Web API node wrapper on npm.

The API endpoints are for getting the current User - https://developer.spotify.com/console/get-current-user/

                                               getting the recently played songs - https://developer.spotify.com/console/get-recently-played/

 

The Web API request just shows pending for a while and shows the aforementioned status code.

Also I am using heroku free dynos to deploy the app. Is that a problem?

It is tough to give you good guidance on your specific app. Fundamentally the problem is that the APIs are giving an error when you send your request. We need to focus on that before anything else. The APIs you list here works as expected, no known issues or bugs, so the only thing I can really do is to ask for either some sample code that can reproduce the issue or getting more verbose output on any parameters, headers etc you're sending off to the API.

Are you also getting errors when calling the APIs manually via the console? (https://developer.spotify.com/console/)

I tried using the console, and it's not working on the account I didn't add, however, it works fine on the account added before the extension. I have attached a screenshot for some more details on this link    "https://ibb.co/Tts9vQP". The link is for the result of the users not added before.

 

Here's the sample code:

https://paste.ofcode.org/RnegJ5j5riCSYFtj8CWLDQ

 

Marked as solution

From the screenshot you linked this isn't a case of the APIs not working or giving errors for the specific user - it's because there is no data for recently played for that specific user. This could be caused by a number of things such a private sessions or simply that you are using a test user that has no listening history?

Well, I checked the Spotify account and it turns out private session was on. This was a silly and hard to debug issue, I guess😅. I then disabled it, and listened to a few songs. The app crashed again, but after checking the logs, I realised it was due to really bad error handling on my part.😅

 

Thank you so much for taking the time to help out junior devs like me, it really means a lot to us, especially when we're just starting out.😃

Suggested posts

Type a product name