This repository was archived by the owner on Jan 20, 2024. It is now read-only.
This repository was archived by the owner on Jan 20, 2024. It is now read-only.
token.refresh failing finally() not defined #170
Open
Description
I am trying to upgrade the dependencies on a node/browser app to current levels to get rig of a grpc problem.
one, google-assistant, uses a module that uses popsicle
└─┬ [email protected]
└─┬ [email protected]
└── [email protected]
i call a client-oauth method to refresh my oauth2 token and now get an error that finally is not defined..
if i change the finally()'s to .then() (workaround)
i now get a : socket.ref is not a function
both from popsicle-transport-http
running node 14.15.3
in electron 11.3.0
i read in my old refresh token and then update it
GA_Auth = new ClientOAuth2({
clientId: keyinfo.installed.client_id,
clientSecret: keyinfo.installed.client_secret,
accessTokenUri: keyinfo.installed.token_uri,
authorizationUri: keyinfo.installed.auth_uri,
redirectUri: "http://localhost:5000/assistant_auth",
scopes: ["https://www.googleapis.com/auth/assistant-sdk-prototype"],
});
...
let tokeninfo = JSON.parse(
fs.readFileSync(_gp.resolve(_ourpath, "token.json"))
);
var token = GA_Auth.createToken(
tokeninfo.access_token,
tokeninfo.refresh_token ? tokeninfo.refresh_token : null
);
// Set the token TTL.
token.expiresIn(60 * 24 * 60); //seconds
console.log("assistant refreshing access token on startup");
// Refresh the users credentials and save the new access token and info.
token
.refresh()
.then((user) => {
console.log("assistant saving tokens on startup");
saveTokens(user);
AssistantInit(gaconfig, geoposition);
})
.catch((error) => {
console.log("error on startup refresh ="+error); //< code goes here on finally/socket.ref
});
Metadata
Metadata
Assignees
Labels
No labels