We are trying to migrate the TOTP factor from Authy to Verify API in Twilio. We reference the following article for the same
From above URL, we were able to pinpoint how to extract the secret created in the Authy. But, we are unsure as to how a secret extracted from the Authy can be used to create a factor in the Verify API. Can you please tell us in detail how to achieve the same?
Since I don't know what programming language you're using, I'll use cURL commands and you can translate those HTTP requests into your language of choice.
First, you'll need to ask Twilio support to enable the migration tools for your Authy app. They will ask you for Authy app ID which you can find in the URL of the Twilio Console when you navigate to your Authy app.
Then you can use the export TOTP secret API that you linked earlier:
$AUTHY_USER_IDis the individual Authy User ID for which you are trying to move their TOTP factor to the Verify service.$AUTHY_API_KEYis the API key for your Authy App.The output will look like this:
secretis what you need to create a Factor in the Verify serviceotpis the one time passcode, the same as what the user would see in their TOTP consumer app (Authy/Google Authenticator/etc).Now you can use the Verify API to create a new Factor:
$VERIFY_SERVICE_SIDis the SID of your Verify Service.$IDENTITYis a unique ID for your user, length between 8 and 64 characters, generated by your external system, such as your user's UUID, GUID, or SID. If the identity does not exist yet, it'll be created automatically as part of this API call.$EXPORTED_AUTHY_SECRETis thesecretthat was returned by the Authy Export API earlier.$TWILIO_ACCOUNT_SIDis your Twilio Account SID.$TWILIO_AUTH_TOKENis your Twilio Auth Token.This API call is documented here: https://www.twilio.com/docs/verify/quickstarts/totp#create-a-new-totp-factor
You can use the
otpreturned by the Authy Export API to verify the new Factor you created:$FACTOR_SIDis the SID of your newly created Factor.$OTP_CODEis theotpcode returned by the Authy Export API.This API call is documented here: https://www.twilio.com/docs/verify/quickstarts/totp#verify-that-the-user-has-successfully-registered
That's it! If you want to verify your user's OTP code, you can create a challenge like this:
$OTP_CODEis theotpcode given to your application by your user.This API call is documented here: https://www.twilio.com/docs/verify/quickstarts/totp#validate-a-token
When exporting from Authy API and creating new factors in Verify, you need to do this quickly so you can verify the new factor using the OTP code given from the Authy export. Here's how I did it for a single Authy user using a bash script:
The various environment variables that were described earlier should be set prior to executing this.