Announcements

Help Wizard

Step 1

NEXT STEP

How to generate OAuth Token for user account from backend code

How to generate OAuth Token for user account from backend code

I am building a test application using the Spotify API that (super simplified) generates a playlist and adds it to my Spotify account. Currently, the playlist is created using a POST call to 

https://api.spotify.com/v1/users/user_id/playlists, which requires a USER_ID and OAUTH TOKEN to succeed. But the manual generated OAuth Token only works for one hour. 
 
Is it possible to regenerate my user account's OAuth Token automatically in the NodeJS backend similar to Refresh Tokens for applications without having to login myself?
Reply
1 Reply

The authorization guide is described in detail here. You must use either the Authorization Code Flow or the Authorization Code Flow with Proof Key for Code Exchange. The access token can be refreshed without any user input when it expires after an hour.

Suggested posts