Forum Discussion
api token timeout change
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}'
- neeeewbieMay 23, 2023MVP
I using the postman, after I get the token.
using this token, I got auth errorthank you
- JRahmMay 23, 2023Admin
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"}}'
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com