refreshAccessToken :: Manager -> HTTP.AccessToken -> IO HTTP.AccessToken
refreshAccessToken manager oldToken = do
    putStrLn $ "trying to refresh token " ++ show oldToken
    let oldRt = HTTP.refreshToken oldToken
    newToken <- fetchRefreshToken manager digigpostKey oldRt
    case newToken of
        Right (AccessToken at _ _ _ _) -> return $ HTTP.AccessToken at oldRt
        Left _ -> throwIO NotAuthenticated
refreshAccessToken :: Manager -> HTTP.AccessToken -> IO HTTP.AccessToken
refreshAccessToken manager oldToken = do
    putStrLn $ "trying to refresh token " ++ show oldToken
    let oldRt = HTTP.refreshToken oldToken
    newToken <- fetchRefreshToken manager digigpostKey oldRt
    case newToken of
        Right (AccessToken at _ _ _ _) -> return $ HTTP.AccessToken at oldRt
        Left _ -> throwIO NotAuthenticated
refreshAccessToken manager oldToken = do
    putStrLn $ "trying to refresh token " ++ show oldToken
    let oldRt = HTTP.refreshToken oldToken
    newToken <- fetchRefreshToken manager digigpostKey oldRt
    case newToken of
        Right (AccessToken at _ _ _ _) -> return $ HTTP.AccessToken at oldRt
        Left _ -> throwIO NotAuthenticated