Connect to Jenkins using API token authentication

  • Release version: Washingtondc
  • Updated August 1, 2024
  • 1 minute to read
  • Connect to Jenkins using API token authentication instead of user name and password.

    Before you begin

    Role required:
    • Jenkins: admin or any user with overall Read and Job Read roles

    About this task

    You can have multiple active API tokens at the same time and track the usage of your tokens. You can also revoke API tokens as needed. You can also use the Jenkins API token for authentication when you're using the Jenkins CLI.

    Procedure

    In the Jenkins banner frame, click your user name to open the user menu.
    1. Navigate to Your Username > Configure > API Token.
    2. Click Add new Token.
    3. Click Generate.
    4. Copy the API token that is generated
    Note:
    • Regenerate the tokens every 6 months (depending on your context). Jenkins displays an indicator concerning the age of the token
    • Use a different token for each application so that if an application is compromised you can revoke its token individually.
    • If your token expires, regenerate the token and update it in the ServiceNow AI Platform instance
    • ServiceNow DevOps DevOps does not support using Legacy API Tokens because Jenkins does not recommend the use of Legacy API Token. For more information, see the Jenkins blog post.