Skip to content

Api only rails app OTP and multi-factor setup for Accounts #270

Answered by janko
hukic-m asked this question in Q&A
Discussion options

You must be logged in to vote

A POST /otp-setup request without parameters will give you valid otp_secret and otp_raw_secret params:

POST /otp-setup
Content-Type: application/json
Accept: application/json
422 Unprocessable Entity
Content-Type: application/json

{
  "otp_secret": "xp5yskxyvfstljx2nsa5z534s5r633gs",
  "otp_raw_secret": "jy4z3hmfhzflsqemmnnjd54p2kvgwlap",
  "field-error": ["otp_secret","invalid secret"],
  "error": "Error setting up TOTP authentication"
}

You can then make another POST /otp-setup request with the given otp_secret and otp_raw_secret, as well as password and otp containing the one-time code generated from otp_secret (e.g. via rotp --secret <otp_secret>).

POST /otp-setup
Content-Type: appli…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hukic-m
Comment options

Answer selected by hukic-m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants