Skip to content

Commit

Permalink
identity: managedIdentityCredential expires-in/-on (#24102)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwf-msr authored and KarishmaGhiya committed Dec 6, 2022
1 parent 009fd86 commit a77babd
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,14 @@ export class ManagedIdentityCredential implements TokenCredential {
if (resultToken) {
logger.info(`SetAppTokenProvider has saved the token in cache`);
logger.info(`token = ${resultToken.token}`);

const expiresInSeconds = resultToken?.expiresOnTimestamp
? Math.floor((resultToken.expiresOnTimestamp - Date.now()) / 1000)
: 0;

return {
accessToken: resultToken?.token,
expiresInSeconds: resultToken?.expiresOnTimestamp / 1000,
expiresInSeconds,
};
} else {
logger.info(
Expand Down

0 comments on commit a77babd

Please sign in to comment.