Forum Discussion

NiHo_202842's avatar
NiHo_202842
Icon for Cirrostratus rankCirrostratus
Jul 03, 2017

iControlREST: X-F5-Auth-Token does not exist

Hello,

 

trying to commit a transaction programatically in Java.

 

PATCH call to

 

https://bigip.company.com/mgmt/tm/transaction/14990898300000?ver=12.1.2

with headers

 

Content-Type: application/json ,
X-F5-Auth-Token: MMY23WRDKEBWIHXVJXMEFJEGF ,  

and payload

 

{"state":"VALIDATING"}

returned code 401 with response

 

{"code":401,"message":"X-F5-Auth-Token does not exist."...}  

Any ideas? I can start a transaction and add actions fine.

 

  • The auth token expires every 20 minutes. Are you sure you're not sending an expired token?

     

    • NiHo_202842's avatar
      NiHo_202842
      Icon for Cirrostratus rankCirrostratus

      Hi ekaleido, I am running the code immediately after program startup so a fresh one is requested. I don't think it's because of a token timeout.

       

  • The auth token expires every 20 minutes. Are you sure you're not sending an expired token?

     

    • NiHo_202842's avatar
      NiHo_202842
      Icon for Cirrostratus rankCirrostratus

      Hi ekaleido, I am running the code immediately after program startup so a fresh one is requested. I don't think it's because of a token timeout.

       

  • If not timeout, then possibly copy & paste (or parsing) error. Run tcpdump to see if your program is sending a correct token.

     

    If not parsing bug, then possibly you didn't get the token at all. Check the response status code and json data.

     

    Try manually first as below.

     

    Get a token:

     

    curl -sk https://mgmtPort/mgmt/shared/authn/login -X POST -H "Content-Type: application/json" \
     -d '{"username":"admin", "password":"secret", "loginProviderName":"tmos"}'

    Output (abridged):

     

    {"username":"admin",
     ...
     "token": {
       "token":"3YJFTKX4434X5ZZ7LGBPS5CAVA",
       "name":"3YJFTKX4434X5ZZ7LGBPS5CAVA", 
       ...
     },
     "timeout":1200,       <<< seconds (=20 min)
     "startTime":"2017-07-05T13:42:47.103+1200",
     ...
    }

    Use the token (let go, Luke):

     

     curl -sk -H "X-F5-Auth-Token: 3YJFTKX4434X5ZZ7LGBPS5CAVA" \
      https://mgmtPort/mgmt/tm/sys/version

    When you've got a wrong token:

     

     curl -sk -H "X-F5-Auth-Token: 3YJFTKX4434X5ZZ7LGBPS5CA" \ <<< forgot the last two chars.
      https://mgmtPort/mgmt/tm/sys/version

    Output

     

    {"code":401,"message":"X-F5-Auth-Token does not xist.", ...}

    You can check the available tokens on the system as below:

     

     curl -sk -H "X-F5-Auth-Token: 3YJFTKX4434X5ZZ7LGBPS5CAVA" \
      https://mgmtPort/mgmt/shared/authz/tokens  | python -m json.tool | grep \"token\"

    Output:

     

                "token": "3YJFTKX4434X5ZZ7LGBPS5CAVA",
  • Can you run a simple iControl REST request (such as getting

    /mgmt/tm/sys/version
    ) using the token? Also, double check if the token really exists (
    /mgmt/shared/authz/tokens
    ) immediately after you got
    X-F5-Auth-Token does not exist
    error. If the token works for non-transaction requests and exists, then something odd going on in transaction: in that case, I suggest you to contact F5 Support for thorough analysis.