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

Get Access token without user interaction?

Get Access token without user interaction?

So this has been bothering me for the longest. I’ve created a script using the Spotipy library. I’m collecting data on my most recently played tracks.

 

Everything is fine except refreshing the access token. I have a bit of code which returns the token. When i run it in Jupyter Notebook It briefly opens and closes the web browser then returns my token. This is great.

 

However when i run it on google cloud my function ends up timing out with a log saying.

’user authentication requires user interaction for web browser’

 

so my question is is there ANY way of completely automating the process of getting an access token without needing me to do anything. I posted this on stackoverflow here

 

Reply
1 Reply


so my question is is there ANY way of completely automating the process of getting an access token without needing me to do anything


No. You only need to go through the authorization process once, after which the access token can be automatically refreshed using the refresh token.

 

If you want to run your code on google cloud, then authorize your app the first time with a local script, then find a way of persistently storing the authorization information such that it can be accessed by your code on google cloud.

 

More specifically, when you authorize the user using spotipy, a JSON file will be created with your authorization information. You need to find a way to access and update this file from Google Cloud.

Suggested posts