You cannot use TOTP in combination with a basic auth request. The part of the documentation you referenced is only applicable if you use TFA via SMS. It seems the documentation is not fully clear about that but in the UI where you activate TOTP it says "TOTP requires OAuth Internal login mode."
Therefore when using TOTP you have to follow the OAuth process for authentication:
1. Request your JWT token
This can be achieved via a form-urlencoded request against the oauth endpoint.
https://cumulocity.com/guides/10.7.0-beta/reference/login/
POST /tenant/oauth HTTP/1.1
Host: examples.cumulocity.com
Content-Type: application/x-www-form-urlencoded
grant_type=PASSWORD&username=<<myUser>>&password=<<myPassword>>&tfa_code=<<myTfaCode>>&tenant_id=<<myTenant>
2. Use the JWT for following API calls
In the response headers of the previous request you should see a Set-Cookie header. From this header you can grab the JWT. Note that the Set-Cookie header sets more than one cookie. You want to grab the authorization one (pretty long base64 string).
You can then do your request with bearer token authentication:
curl --location --request POST 'my_tenant/application/applications'
--header 'Authorization: Bearer <<the copy+pasted base64 string from the Set-Cookie header>>'
** some other headers **
--data-raw '{
}'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…