Hello,

      2 years back I created an API token for my account and I still, now, can use it with basic auth.
      This API token is no more visible in jenkins UI.

      In July 2023 we did an upgrade of Jenkins (from 2.375.2 to 2.401.2)
      Starting from that date, all newly created API tokens are not working with basic auth. (401 unauthorized)

      We now are in 2.426.1 version of Jenkins and we still have the same issue.

      Example curl command which gives unauthorized 401 error:

      curl --silent -u <username>:<api_token> https://jenkins/job/<jobname>/lastBuild/api/json

          [JENKINS-72440] New API token returns 401

          Akilesh DS added a comment -

          Update:

          Looks like using the Azure object ID instead of UPN solves the issue for newly created API tokens.

          But there are below concerns still:

          • In latest jenkins version the old api tokens are not shown.
          • <upn>:<old_api_token> works
          • <object_id>:<old_api_token> does not work
          • <object_id>:<new_api_token> works
          • <upn>:<new_api_token> does not work
          • It is difficult for users to remember the objectid which is generally very big in size
          • And will the old api token get disabled soon then we forsee a change in the configurations/settings in our jenkins.

          Akilesh DS added a comment - Update: Looks like using the Azure object ID instead of UPN solves the issue for newly created API tokens. But there are below concerns still: In latest jenkins version the old api tokens are not shown. <upn>:<old_api_token> works <object_id>:<old_api_token> does not work <object_id>:<new_api_token> works <upn>:<new_api_token> does not work It is difficult for users to remember the objectid which is generally very big in size And will the old api token get disabled soon then we forsee a change in the configurations/settings in our jenkins.

          Basil Crow added a comment -

          In latest jenkins version the old api tokens are not shown.

          Are you sure the old API token is not a legacy API token, visible by clicking "Show Legacy API Token"?

          Basil Crow added a comment - In latest jenkins version the old api tokens are not shown. Are you sure the old API token is not a legacy API token, visible by clicking "Show Legacy API Token"?

          Akilesh DS added a comment -

          Hello basil 

          I do not see the option "Show Legacy API Token". Old tokens are not shown in the UI but continue to work (with username and token combination). Newly created tokens with objectid and token combination.

          Akilesh DS added a comment - Hello basil   I do not see the option "Show Legacy API Token". Old tokens are not shown in the UI but continue to work (with username and token combination). Newly created tokens with objectid and token combination.

          Basil Crow added a comment -

          Do you have steps to reproduce the issue from scratch?

          Basil Crow added a comment - Do you have steps to reproduce the issue from scratch?

            Unassigned Unassigned
            akileshds Akilesh DS
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: