-
Hey all would appreciate some guidance to any docs or anything like that that will point me to setting up OTP's as Second Factor for api only rails application. I've setup the JWT auth and it works great.
Table setup
After the setup I would be more than happy to update the postman docs for the JSON API with required params and everything. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
A 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
Content-Type: application/json
Accept: application/json
{
"otp_secret": "xp5yskxyvfstljx2nsa5z534s5r633gs",
"otp_raw_secret": "jy4z3hmfhzflsqemmnnjd54p2kvgwlap",
"otp": "490273",
"password": "secret123"
} 200 OK
Content-Type: application/json
{ "success": "TOTP authentication is now setup" } When the user is logging in, you can then authenticate via TOTP by calling POST /otp-auth
Content-Type: application/json
Accept: application/json
{ "otp": "538423" } 200 OK
Content-Type: application/json
{ "success": "You have been multifactor authenticated" } Finally, TOTP authentication can be disabled by calling |
Beta Was this translation helpful? Give feedback.
A
POST /otp-setup
request without parameters will give you validotp_secret
andotp_raw_secret
params:You can then make another
POST /otp-setup
request with the givenotp_secret
andotp_raw_secret
, as well aspassword
andotp
containing the one-time code generated fromotp_secret
(e.g. viarotp --secret <otp_secret>
).