elegant-traffic-69008
02/02/2024, 6:53 AMbland-eye-99092
02/02/2024, 9:05 AMelegant-traffic-69008
02/05/2024, 10:00 AMRecoveryFlow
with the code, the returned RecoveryFlow
state is still on sentEmail
. This is how i initiate the flow:
Response<RecoveryFlow> recoveryFlow =
await _oryFrontendApi.createNativeRecoveryFlow();
UpdateRecoveryFlowWithCodeMethod updateRecovery =
UpdateRecoveryFlowWithCodeMethod((b) {
b.email = email;
b.method = UpdateRecoveryFlowWithCodeMethodMethodEnum.code;
});
UpdateRecoveryFlowBodyBuilder builder = UpdateRecoveryFlowBodyBuilder();
builder.oneOf = OneOfDynamic(
typeIndex: 0,
types: [UpdateRecoveryFlowWithCodeMethod],
value: updateRecovery);
Response<RecoveryFlow> recoveryFlowResponse =
await _oryFrontendApi.updateRecoveryFlow(
flow: recoveryFlow.data!.id,
updateRecoveryFlowBody: builder.build(),
);
And this is how I update it with the code:
Response<RecoveryFlow> recoveryFlow =
await _oryFrontendApi.getRecoveryFlow(id: recoveryFlowId);
UpdateRecoveryFlowWithCodeMethod updateRecovery =
UpdateRecoveryFlowWithCodeMethod((b) {
b.code = code;
b.method = UpdateRecoveryFlowWithCodeMethodMethodEnum.code;
});
UpdateRecoveryFlowBodyBuilder builder = UpdateRecoveryFlowBodyBuilder();
builder.oneOf = OneOfDynamic(
typeIndex: 0,
types: [UpdateRecoveryFlowWithCodeMethod],
value: updateRecovery);
Response<RecoveryFlow> response =
await _oryFrontendApi.updateRecoveryFlow(
flow: recoveryFlow.data!.id,
updateRecoveryFlowBody: builder.build(),
);
bland-eye-99092
02/05/2024, 10:02 AMelegant-traffic-69008
02/05/2024, 10:04 AMupdateRecoveryFlow
:
_$RecoveryFlow (RecoveryFlow {
active=code,
expiresAt=2024-02-05 102531.227621Z,
id=01a9310c-eb84-429f-a204-67b976fb8520,
issuedAt=2024-02-05 095531.227621Z,
requestUrl=https://api.accounts.hgv.it/self-service/recovery/api,
state=sentEmail,
type=api,
ui=UiContainer {
action=https://api.accounts.hgv.it/self-service/recovery?flow=01a9310c-eb84-429f-a204-67b976fb8520,
messages=[UiText {
id=4060006,
text=The recovery code is invalid or has already been used. Please try again.,
type=error,
}],
method=POST,
nodes=[UiNode {
attributes=UiNodeAttributes {
oneOf=UiNodeInputAttributes {
disabled=false,
name=csrf_token,
nodeType=input,
required_=true,
type=hidden,
value=,
},
},
group=default_,
messages=[],
meta=UiNodeMeta {
},
type=input,
}, UiNode {
attributes=UiNodeAttributes {
oneOf=UiNodeInputAttributes {
disabled=false,
name=code,
nodeType=input,
pattern=[0-9]+,
required_=true,
type=text,
},
},
group=code,
messages=[],
meta=UiNodeMeta {
label=UiText {
id=1070010,
text=Recovery code,
type=info,
},
},
type=input,
}, UiNode {
attributes=UiNodeAttributes {
oneOf=UiNodeInputAttributes {
disabled=false,
name=method,
nodeType=input,
type=hidden,
value=code,
},
},
group=code,
messages=[],
meta=UiNodeMeta {
},
type=input,
}, UiNode {
attributes=UiNodeAttributes {
oneOf=UiNodeInputAttributes {
disabled=false,
name=method,
nodeType=input,
type=submit,
value=code,
},
},
group=code,
messages=[],
meta=UiNodeMeta {
label=UiText {
id=1070005,
text=Submit,
type=info,
},
},
type=input,
}, UiNode {
attributes=UiNodeAttributes {
oneOf=UiNodeInputAttributes {
disabled=false,
name=email,
nodeType=input,
type=submit,
value=emaborsa2@gmail.com,
},
},
group=code,
messages=[],
meta=UiNodeMeta {
label=UiText {
id=1070008,
text=Resend code,
type=info,
},
},
type=input,
}],
},
})bland-eye-99092
02/05/2024, 10:05 AMThe recovery code is invalid or has already been used. Please try again.Looks like the code is invalid. make sure there is no whitespace around the code.
elegant-traffic-69008
02/05/2024, 10:11 AMbland-eye-99092
02/05/2024, 10:12 AMcreateNativeRecoveryFlow
?elegant-traffic-69008
02/05/2024, 10:14 AMcreateNativeRecoveryFlow
always works, I get the code per email. The updateRecoveryFlow
to supply the code always returns that message.elegant-traffic-69008
02/05/2024, 10:19 AMlog(response.toString());
, here is where I see that message.
I must confess, I am not sure if this approach is correct, since I can't find flutter samples and the other samples only shows how to initiate the flow.bland-eye-99092
02/05/2024, 10:21 AMbland-eye-99092
02/05/2024, 10:33 AMelegant-traffic-69008
02/05/2024, 10:48 AMcontinueWith
property:
https://github.com/ory/examples/blob/e61b8622ef65551c7ca55865d66ebe796fc54c29/flutter-ory-network/lib/services/auth.dart#L360bland-eye-99092
02/05/2024, 10:49 AMtext=An email containing a recovery code has been sent to the email address you provided. If you have not received an email, check the spelling of the address and make sure to use the address you registered with.,If you submit an email, we assume you want to receive a new code. you only get continue_with if the code was correct.
elegant-traffic-69008
02/05/2024, 10:54 AMbland-eye-99092
02/05/2024, 10:54 AMtext=The recovery code is invalid or has already been used. Please try again.,this is the message you’re getting, right? It does state that the code is wrong.
elegant-traffic-69008
02/05/2024, 10:57 AMAn email containing a recovery code has been sent to the email address you provided. If you have not received an email, check the spelling of the address and make sure to use the address you registered with
bland-eye-99092
02/05/2024, 10:58 AMelegant-traffic-69008
02/05/2024, 11:14 AM