Casbin Forum runs on Casnode, the open-source Discourse-style forum. Try the Casnode demo →
Casbin Forum

I'm facing an issue with casdoor-go-sdk while trying to enable MFA.

When I directly call the Casdoor API, everything works perfectly.
(Here, the SECRET and RECOVERY_CODES are obtained from the /api/mfa/setup/initiate endpoint.)

curl --location --request POST 'http://localhost:8000/api/mfa/setup/enable?mfaType=app&owner=appscode&secret=SECRET&dest=null&recoveryCodes=RECOVERY_CODES&name=NAME' \
--header 'accept: application/json' \
--header 'Authorization: Bearer {{token}}' \
--header 'Cookie: casdoor_session_id=SESSION_ID'

However, I’m encountering an issue when trying to perform the same action using the Go SDK.

Problem Details

In the Go SDK code, the Enable function does not accept recoveryCodes as a parameter.
As a result, when I invoke it, I receive the following response:

Response:

{
    "error": "Failed to enable MFA: recovery codes is missing"
}

SDK Code Snippet

func (c *Client) Enable(owner, mfaType, name, secret string) (*MfaVerifyResponse, error) 

Am I missing something here?
Should the SDK include recoveryCodes as part of the request payload, or is there another recommended way to handle this?
Thanks in advance for your help!

2views
1 minread
1 / 1
Oct 2025