Forum Discussion

neeeewbie's avatar
May 22, 2023

api token timeout change

Hi

I need your help ~ 

I checked below url but does not work,, 

refer : https://my.f5.com/manage/s/article/K43590271

I entered the https://ipaddress/mgmt/shared/authz/tokens/<token vlaue>

error occurred 

 

please let me know if you know that 

 

thank you ! 

 

  • Hi neeeewbie, that's the right interface, what method are you using? This should work:

    curl -sk https://$HOST/mgmt/shared/authz/tokens/$TOKEN \
     -X PATCH -H "Content-type: application/json" -H "X-F5-Auth-Token: $TOKEN" \
     -d '{"timeout" : 4200}'
  • Hi neeeewbie, that's the right interface, what method are you using? This should work:

    curl -sk https://$HOST/mgmt/shared/authz/tokens/$TOKEN \
     -X PATCH -H "Content-type: application/json" -H "X-F5-Auth-Token: $TOKEN" \
     -d '{"timeout" : 4200}'
    • I using the postman, after I get the token.  
      using this token, I got auth error

      thank you 

       

      • JRahm's avatar
        JRahm
        Icon for Admin rankAdmin

        I dug into this to see how we did it with the f5sdk back in the day...it has a debug mode that will output the request as a curl command. Successful execution in the sdk:

        b = ManagementRoot('ltm15', 'adminuser', 'adminpassword', debug=True, token=True)
        token = b.shared.authz.tokens_s.token.load(name=b.icrs.token)
        token.timeout = 3600
        token.update(user=token.user)

        And the debug output:

        b.debug_output[2]
        'curl -k -X PUT https://ltm15:443/mgmt/shared/authz/tokens/IN6XYCZIBIMSAVANXOS4E7RTSM/ -H \'User-Agent: python-requests/2.31.0 f5-icontrol-rest-python/1.3.13\' -H \'Accept-Encoding: gzip, deflate\' -H \'Accept: */*\' -H \'Connection: keep-alive\' -H \'Content-Type: application/json\' -H \'Content-Length: 534\' -H \'X-F5-Auth-Token: IN6XYCZIBIMSAVANXOS4E7RTSM\' -d \'{"address": "172.16.2.206", "authProviderName": "tmos", "expirationMicros": 1684862265552000, "generation": 1, "kind": "shared:authz:tokens:authtokenitemstate", "lastUpdateMicros": 1684861065552579, "name": "IN6XYCZIBIMSAVANXOS4E7RTSM", "partition": "[All]", "selfLink": "https://localhost/mgmt/shared/authz/tokens/IN6XYCZIBIMSAVANXOS4E7RTSM", "startTime": "2023-05-23T09:57:45.552-0700", "timeout": 3600, "token": "IN6XYCZIBIMSAVANXOS4E7RTSM", "user": {"link": "https://localhost/mgmt/shared/authz/users/admin"}, "userName": "admin"}\''
        

        So it looks like a PUT, not a PATCH, sorry about that. I was able to trim everything out of the update except for the timeout and the user fields, so a final working curl command for me (with newlines for reading clarity):

        curl -k -X PUT https://ltm15:443/mgmt/shared/authz/tokens/IN6XYCZIBIMSAVANXOS4E7RTSM/ 
          -H 'User-Agent: python-requests/2.31.0 f5-icontrol-rest-python/1.3.13' 
          -H 'Content-Type: application/json' 
          -H 'X-F5-Auth-Token: IN6XYCZIBIMSAVANXOS4E7RTSM' 
          -d '{"timeout": 1300, "user": {"link": "https://localhost/mgmt/shared/authz/users/admin"}}'