Skip to main content

tfaAppGenerateSetupCode

TfaSetupCodeWrapper tfaAppGenerateSetupCode()

GET /api/2.0/settings/tfaapp/setup

Generate the TFA setup code

Issues the secret the current user has to enter in an authenticator application before the authenticator-application method can be used, both as a scannable QR-code image and as a key for manual entry. The call is reachable only with a confirmation token carrying the TfaActivation role, obtained from GET api/2.0/settings/tfaapp/confirm or from the login flow; an ordinary bearer token is refused. The authenticator method has to be enabled on the portal and be its current policy, and the account must have no application linked yet: for an already-linked account the call answers 405, so reset the credential first with PUT api/2.0/settings/tfaappnewapp. Repeating the call is safe and hands back the same secret for the account, so the QR code and the manual key always describe one and the same credential. qrCodeSetupImageUrl is a base64 data: URL of a PNG image, and account is the label the application will show. Finish the setup by sending a code from the application to POST api/2.0/settings/tfaapp/validate.

Parameters​

This endpoint does not need any parameter.

Responses​

Status codeDescriptionTypeResponse headers
200The account label, the manual entry key and the QR-code image for linking an authenticator applicationTfaSetupCodeWrapperX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
405The authenticator method is not enabled on this portal, or the account already has an application linked--
401UnauthorizedErrorApiResponse-
429Too Many Requests.ErrorApiResponseRetry-After
500Internal Server Error.ErrorApiResponse-
502Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON.--
503Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON.--

Return type​

TfaSetupCodeWrapper

Authorization​

Basic, OAuth2 (scopes: read, write), ApiKeyBearer, asc_auth_key, Bearer, OpenId

HTTP request headers​

  • Content-Type: Not defined
  • Accept: application/json