Skip to content

Commit

Permalink
identity: managedIdentityCredential expires-in/-on (Azure#24102)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwf-msr authored Dec 5, 2022
1 parent 5706943 commit 5691cc1
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 5691cc1

Please sign in to comment.