我在我的 Tesla ( https://teslaapi.dev/ ) 上使用 Smartcar API 并成功发出请求,但我认为访问令牌已过期,我不知道如何刷新它。
我遵循了本指南:https ://smartcar.com/docs/integration-guides/express/request/ 它讨论了访问令牌,但没有告诉我如何获取刷新令牌。
// ./index.js
app.get('/vehicle', function(req, res) {
// TODO: Request Step 2: Get vehicle information
return smartcar.getVehicleIds(access.accessToken)
.then(function(data) {
// the list of vehicle ids
return data.vehicles;
})
.then(function(vehicleIds) {
// instantiate the first vehicle in the vehicle id list
const vehicle = new smartcar.Vehicle(vehicleIds[0], access.accessToken);
return vehicle.info();
})
.then(function(info) {
res.render('vehicle', {
info: info,
});
});
});
这不再起作用:{“error”:“authentication_error”,“message”:“提供的令牌无效或过期。” }
我认为这是因为我需要用刷新令牌替换 accessToken。我怎样才能做到这一点?