Continuing the discussion from How to add json custom api command to Nightbot?:
I like to add the same !song command (giving back the currently played song title + artist name) as mentioned in the thread linked above.
But I am struggling with the access token.
I have run through this quick start guide to generate a token:
https://developer.spotify.com/documentation/web-api/quick-start/
So far so good.
When copying+pasting the token into the urlfetch, the command works fine.
As I have learned here, the token expires after one hour and needs to be refreshed:
https://developer.spotify.com/documentation/general/guides/authorization-guide/#authorizaton-code-flow
Unfortunately I am not coding savvy enough to update the urlfetch programmatically, so I do not have to change it hourly by hand.
I guess I have to include an external script which is handling the authentification flow from Pastebin, like it is done here:
and/or alternatively with Apps Script like is shown here, e.g.:
I tried to work it out for a couple of days, but always stuck on a certain point where my little understanding of coding sets limits when adapting the provided examples to the Spotify API specifications. Is there any tutorial on the net or a person here who can help me out?
Many thanks in advance.