Set Two-Factor Google Verification

How to set two-factor Google verification through the CoSync REST API #

Set the two factor google authentication verification for the user. This function controls whether two-factor google verification is enabled for the logged in user or not.

This function returns the two-factor Google secret key for the user. This can then be used by the user to set up the Google authentication application for two-factor verification. The function will also return the QR Data Image, which the application can print to later scan in to the Google authentication application.

If the twoFactor parameter is set to true, CoSync Auth will send an email to the user’s email handle with the QRDataImage for the google authentication.

Method #
Headers #
    access-token: "<Access Token>"
Data Parameter #
        twoFactor: "<true or false>",

Response: #

Success: #

StatusCode: #
    200 (OK)
Contents: #
        "googleSecretKey": "<google secret key>",
        "QRDataImage": "<google QR data image>"

Error: #

StatusCode: #
    400 (BAD REQUEST)
Content: #
        code: "<internal error code>",
        message: "<readable error description>"

The internal codes are integers:

  • 401 - app no longer exists
  • 402 - app is suspended
  • 403 - missing parameter
  • 404 - user account is suspended
  • 405 - invalid access token
  • 408 - app does not support google two-factor verification
  • 413 - app is migrated
  • 500 - internal server error
  • 602 - invalid data