Skip to content

Commit

Permalink
FIX: update expiration time of a newly refreshed token
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Jul 20, 2023
1 parent 77042f6 commit 1153bdf
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions spotify.reb
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,16 @@ refresh: function[
])
]
data: attempt [load-json result/3]
either result/1 >= 400 [
if result/1 >= 400 [
sys/log/error 'SPOTIFY "Failed to refresh access token!"
if data/error_description [ sys/log/error 'SPOTIFY data/error_description ]
none
][
attempt [data/expires_in: now + (to time! data/expires_in)]
ctx/token: data
return none
]
try/with [
data/expires_in: now + (to time! data/expires_in)
ctx/token: data
store-config ctx
] :print
]

request: func [
Expand Down

0 comments on commit 1153bdf

Please sign in to comment.