@@ -41,7 +41,6 @@ func SubmitLoginFlowWrapper(cookie string, flowID string, csrfToken string, pass
4141 submitDataBody .UpdateLoginFlowWithPasswordMethod .SetCsrfToken (csrfToken )
4242
4343 apiClient := client .NewAPIClient (config .KratosClientConfig )
44-
4544 resp , r , err := apiClient .FrontendAPI .UpdateLoginFlow (context .Background ()).Cookie (cookie ).Flow (flowID ).XSessionToken ("" ).UpdateLoginFlowBody (submitDataBody ).Execute ()
4645
4746 responseCookies := r .Header ["Set-Cookie" ]
@@ -57,7 +56,7 @@ func SubmitLoginFlowWrapper(cookie string, flowID string, csrfToken string, pass
5756 return resp .Session , responseCookies [1 ], "" , nil
5857}
5958
60- func SubmitLoginWithMFAWrapper (cookie string , flowID string , csrfToken string , totp string ) (client.Session , string , error ) {
59+ func SubmitLoginWithMFAWrapper (cookie string , flowID string , csrfToken string , totp string ) (client.Session , string , string , error ) {
6160 submitDataBody := client.UpdateLoginFlowBody {UpdateLoginFlowWithTotpMethod : client .NewUpdateLoginFlowWithTotpMethod ("totp" , totp )} // SubmitSelfServiceLoginFlowBody |
6261
6362 submitDataBody .UpdateLoginFlowWithTotpMethod .SetCsrfToken (csrfToken )
@@ -66,11 +65,13 @@ func SubmitLoginWithMFAWrapper(cookie string, flowID string, csrfToken string, t
6665
6766 resp , r , err := apiClient .FrontendAPI .UpdateLoginFlow (context .Background ()).Flow (flowID ).UpdateLoginFlowBody (submitDataBody ).XSessionToken ("" ).Cookie (cookie ).Execute ()
6867
68+ errMsg := helper .ExtractErrorMessage (r )
69+
6970 if err != nil {
70- return * client .NewSessionWithDefaults (), "" , err
71+ return * client .NewSessionWithDefaults (), "" , errMsg , err
7172 }
7273
7374 responseCookies := r .Header ["Set-Cookie" ]
7475
75- return resp .Session , responseCookies [0 ], nil
76+ return resp .Session , responseCookies [0 ], "" , nil
7677}
0 commit comments