If you use the "npm login" command to authenticate with the Artifactory npm repository, after logging in, the generated token will be saved in the ~/.npmrc file by default, with a default validity period of 1 month (2592000s). After one month, you need to log in again via "npm login".
How to extend the validity period of this token to avoid frequent "npm login" attempts?
Solution
You can modify the default expiration date of the token by the following steps:
- Edit the configuration file: $ARTIFACTORY_HOME/var/etc/artifactory/artifactory.system.properties, add the following parameter, and modify it to your expected time, such as 1 year(31536000s):
artifactory.artifactory.tokens.expiration.timeSecs=31536000
- Restart Artifactory.
- Run "npm login" again. You can see on the UI that the token's validity period has been changed to 1 year.