Hi all, is somebody working with flutter? I am try...
# talk-kratos
e
Hi all, is somebody working with flutter? I am trying to understand the
frontendApi.updateLoginFlow
method. It requies an
UpdateLoginFlowBody
, how can I pass/set another type, e.g. an
UpdateLoginFlowWithPasswordMethod
?
t
Hi @elegant-traffic-69008, were you able to solve this? Facing the exact same issue and not being able to create a
UpdateLoginFlowBody
from a
UpdateLoginFlowWithPasswordMethod
.
Hi @bland-eye-99092 Any tip regarding this?
e
Yes, been able, here is my code:
Copy code
Response<LoginFlow> loginFlow =
    await _ory.createNativeLoginFlow(refresh: true);

UpdateLoginFlowWithPasswordMethod updateLogin =
    UpdateLoginFlowWithPasswordMethod(
  (b) {
    b.identifier = email;
    b.password = password;
    b.method = "password";
  },
);
UpdateLoginFlowBodyBuilder builder = UpdateLoginFlowBodyBuilder();
builder2.oneOf = OneOfDynamic(
    typeIndex: 0,
    types: [UpdateLoginFlowWithPasswordMethod],
    value: updateLogin);

Response<SuccessfulNativeLogin> response = await _ory.updateLoginFlow(
  flow: loginFlow.data!.id,
  updateLoginFlowBody: builder.build(),
);
@thankful-jelly-57785 Which provider are you using?
t
Hi @elegant-traffic-69008 Thanks for sharing the code. I ended up implementing it in a similar way by copying from the UpdateLoginFlowBody class definition. I thought there is simpler way to just cast the UpdateLoginFlowWithPasswordMethod to UpdateLoginFlowBody but sadly not. I use Riverpod as state management. I am also planning to open source the Auth part of my app since i did not find any example of Ory based Auth with Flutter Native. Maybe you are interested in this?
e
Actually I just asked, because if you used Microsoft B2C, I could give you some hints before you waste time struggling on some steps.
t
Ah alright. Thanks anyways!