Missing ClientSubmitSelfServiceLoginFlowBody and ClientSubmitSelfServiceSettingsFlowBody constructors
Preflight checklist
- [X] I could not find a solution in the existing issues, docs, nor discussions.
- [X] I agree to follow this project's Code of Conduct.
- [X] I have read and am following this repository's Contribution Guidelines.
- [ ] This issue affects my Ory Cloud project.
- [ ] I have joined the Ory Community Slack.
- [ ] I am signed up to the Ory Security Patch Newsletter.
Describe the bug
Hi,
Using the .NET client SDK, the model classes ClientSubmitSelfServiceLoginFlowBody and ClientSubmitSelfServiceSettingsFlowBody are missing the constructors below:
public ClientSubmitSelfServiceLoginFlowBody(ClientSubmitSelfServiceLoginFlowWithLookupSecretMethodBody body)
public ClientSubmitSelfServiceLoginFlowBody(ClientSubmitSelfServiceLoginFlowWithWebAuthnMethodBodybody)
public ClientSubmitSelfServiceSettingsFlowBody(ClientSubmitSelfServiceSettingsFlowWithLookupMethodBody body)
public ClientSubmitSelfServiceSettingsFlowBody(ClientSubmitSelfServiceSettingsFlowWithWebAuthnMethodBody body)
required to submit the corresponding flow methods. Tried to manually set the ActualInstance property, but the setter performs type checking and fails.
Please advise.
Reproducing the bug
- Create a .NET application.
- Add the Ory.Client Nuget.
- Try to build the code below:
ClientSubmitSelfServiceSettingsFlowBody body =
new ClientSubmitSelfServiceSettingsFlowBody(
new ClientSubmitSelfServiceSettingsFlowWithLookupMethodBody());
Relevant log output
No response
Relevant configuration
No response
Version
0.0.1-alpha.30
On which operating system are you observing this issue?
No response
In which environment are you deploying?
No response
Additional Context
No response
So sorry to hear you having trouble with this! The SDK is unfortunately fully autogenerated and the generator is known to have some bugs. Unfortunately we don’t yet have someone responsible for DotNet.
Would the equal raw HTTP request suffice as a workaround?
Hi,
If no other solution is available, that is an option. Thank you for your support.
Could you share the full call in the SDK you are making? Will translate to REST then :)
Hi,
Below is a snippet of the relevant part of the code calling the SDK. Note that this code does not build because the called ClientSubmitSelfServiceLoginFlowBody constructor does not exist with argument type of ClientSubmitSelfServiceLoginFlowWithLookupSecretMethodBody. If it helps I can send samples for the other 3 missing constructors, but it is more of the same.
[Inject]
private V0alpha2Api Api { get; set; }
protected async Task OnSubmit()
{
ClientSubmitSelfServiceLoginFlowBody body;
body = new ClientSubmitSelfServiceLoginFlowBody(
new ClientSubmitSelfServiceLoginFlowWithLookupSecretMethodBody(
_form.Model.CsrfToken,
_form.Model.LookupSecret,
"lookup_secret"));
var login = await Api.SubmitSelfServiceLoginFlowAsync(
_flow.Id,
null,
body);
}
Let me know if you need any further input on our part.
Sorry, I missed the notification! I’ll answer tomorrow if you’re still looking for a solution :)
No problem. This issue is still on the pending tasks list. If you have any update, let me know and we will try it out.
Ok! So, the way you submit this form with REST would be like this:
curl 'https://<project>.projects.oryapis.com/api/kratos/public/self-service/login?flow=<the flow id you have>' \
-H 'content-type: application/x-www-form-urlencoded' \
-H 'cookie: csrf_token_<a unique hash from the server>=<the csrf cookie>; ory_session_<a unique id from the server>=<the session cookie>' \
--data-raw 'csrf_token=Lo%2F4J2Jrb82dpmmONHmWCzd2b2axYw6U2eWZX3%2BOm%2F5r0BB3yIqMDXlbE1zWgnh2qTNH513c9aM%2FG8xi7yMU2w%3D%3D&totp_code=&lookup_secret=<the code frmo the user>&method=lookup_secret' \
--compressed
The cookies csrf_token_... and ory_session_... should be copied from the request that ends up at your server. So you can basically just "pipe" the Set-Cookie header that arrives in your handler to Ory Kratos. That should do the trick! Make sure those cookies are set in the request with some printf statement. If they are not set, the flow will fail!
Hope this helps :)
This should be fixed by now!