Hi there, I am currently trying Recovery flow. Th...
# talk-kratos
c
Hi there, I am currently trying Recovery flow. The email was sent and I got a link with token. Can I use SDK (updateRecoveryFlowWithHttpInfo) or GET for checking token and flow? - now I am getting 500 Internal Server Error
b
Can you post the error you’re getting?
c
Call /new?flow=2fcef4be-9bf2-4e89-8b63-e3e4791cf7cf failed with cause java.util.NoSuchElementException: Collection is empty.
I see that this is settings flow ID.
sh.ory.kratos.ApiException: Message: Internal Server Error
Can I set my return link (if token is not valid) in kratos config?
b
You can se the after recovery return to url in the kratos config, yes. But if the recovery token is not valid, the user is redirected to the frontend and receives a new flow, where they need to enter their email address again.
c
I see, but can I set custom page for this ? I don’t want to return to the frontend UI
b
I don’t think so.
c
ok, did you check the error what I have sent? do you need more information?
b
Would be great to see the actual error description. There should be a JSON document returned as well.
c
this is the problem. I don’t get json response. I got 500 :
HTTP response code: 500
• HTTP response body: 500: java.util.NoSuchElementException: Collection is empty.
Copy code
HTTP response headers: {connection=[keep-alive], content-length=[59], content-type=[text/plain; charset=UTF-8]}
	at sh.ory.kratos.ApiClient.handleResponse(ApiClient.java:1066)
	at sh.ory.kratos.ApiClient.execute(ApiClient.java:979)
	at sh.ory.kratos.api.FrontendApi.updateRecoveryFlowWithHttpInfo(FrontendApi.java:3838)
	at com.vivira.services.KratosService$updateRecoveryFlowWithHttpInfo$2.invokeSuspend(KratosService.kt:226)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
We want to proxy a recovery link from the email and send the request to kratos using java SDK. Our code:
Copy code
// <http://127.0.0.1:4433/self-service/recovery?flow=f631aee4-dbbc-4e52-91be-ba4c6883b2f4&token=gu87EdXnuQTlc8sVIf4ote4ViBrAKhVC>

private suspend fun updateRecoveryFlowWithHttpInfo(flow: String, token: String): ApiResponse<RecoveryFlow> = withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
    val updateRecoveryFlowBody = UpdateRecoveryFlowWithLinkMethod().apply {
        method = LINK_METHOD
    }
    kratosFrontEndApi.updateRecoveryFlowWithHttpInfo(flow, UpdateRecoveryFlowBody(updateRecoveryFlowBody), token, null)
}