Something went wrong. Try again.
A music player that connects to your cloud/distributed storage. forked from tokono.ma/diffuse
Something went wrong. Try again.
12345678910111213141516171819module Syncing.Services.Dropbox.Token exposing (..)
import Time
isExpired : { currentTime : Time.Posix, expiresAt : Int } -> BoolisExpired { currentTime, expiresAt } = let currentTimeInSeconds = Time.posixToMillis currentTime // 1000
currentTimeWithOffset = -- We add 60 seconds here because we only get the current time every minute, -- so there's always the chance the "current time" is 1-60 seconds behind. currentTimeInSeconds + 60 in -- If the access token is expired currentTimeWithOffset >= expiresAt