Skip to content

code_verifier should be optional on body types on shopperLogin.resetPassword to support cross_device flow #261

@KierenFoenander

Description

@KierenFoenander

when attempting to use the 'cross_device' flow for password reset the body types are throwing a typescript error due to code_verifier being a required field which it is not in the cross_device flow, additionally user_id parameter is required in this flow and is not a typed attribute at all in this flow so suggest this also be added as optional to the parameters.

below is the error for a payload which looks like this

No overload matches this call.
  Overload 1 of 2, '(options: { parameters?: { [x: `c_${string}`]: any; organizationId?: string; }; headers?: { [key: string]: string; }; body: PasswordActionVerifyRequest; }): Promise<void>', gave the following error.
    Type '{ user_id: string; new_password: string; pwd_action_token: string; channel_id: string; client_id: string; hint: string; }' is not assignable to type 'PasswordActionVerifyRequest'.
      Property 'code_verifier' is missing in type '{ user_id: string; new_password: string; pwd_action_token: string; channel_id: string; client_id: string; hint: string; }' but required in type '{ client_id: string; pwd_action_token: string; code_verifier: string; new_password?: string; channel_id: string; hint?: string; }'.
  Overload 2 of 2, '(options: { parameters?: { [x: `c_${string}`]: any; organizationId?: string; }; headers?: { [key: string]: string; }; body: PasswordActionVerifyRequest; }, rawResponse?: boolean): Promise<...>', gave the following error.
    Type '{ user_id: string; new_password: string; pwd_action_token: string; channel_id: string; client_id: string; hint: string; }' is not assignable to type 'PasswordActionVerifyRequest'.
      Property 'code_verifier' is missing in type '{ user_id: string; new_password: string; pwd_action_token: string; channel_id: string; client_id: string; hint: string; }' but required in type '{ client_id: string; pwd_action_token: string; code_verifier: string; new_password?: string; channel_id: string; hint?: string; }'.

sfcc documentation which documents this flow
https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-password-reset.html#slas-public-client

suggest type go from

type ShopperLoginTypes.PasswordActionVerifyRequest = {
    client_id: string;
    pwd_action_token: string;
    code_verifier: string;
    new_password?: string;
    channel_id: string;
    hint?: string;
} & {
    [key: string]: any;
}

to

type ShopperLoginTypes.PasswordActionVerifyRequest = {
    client_id: string;
    pwd_action_token: string;
    code_verifier?: string;
    new_password?: string;
    channel_id: string;
    user_id?: string 
    hint?: string;
} & {
    [key: string]: any;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions