Skip to content

Reset Password Endpoints Require Authentication #40

@rminasian

Description

@rminasian

The following code:

static void Main(string[] args)
        {
            var client = new OrderCloudClient();
            Task.WaitAll(client.PasswordResets.SendVerificationCodeAsync(new PasswordResetRequest
            {
                ClientID = "client-app-id",
                Email = "my-email",
                URL = "http://reset-password-url.com"
            }));
        }

throws an exception:

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.ArgumentException: clientID is required.
  at OrderCloud.SDK.OrderCloudClient.Require(String value, String name)
  at OrderCloud.SDK.OrderCloudClient.AuthenticateAsync(String clientID, String username, String password, ApiRole[] roles)
  at OrderCloud.SDK.OrderCloudClient.<AuthenticateAsync>d__150.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at OrderCloud.SDK.OrderCloudClient.<EnsureTokenAsync>d__160.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Flurl.Http.FlurlRequest.<SendAsync>d__19.MoveNext()
  --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
  at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout)
  at System.Threading.Tasks.Task.WaitAll(Task[] tasks)
  at TestOrderCloud.Program.Main(String[] args) in c:\projects\TestOrderCloud\TestOrderCloud\Program.cs:line 16 

This happens because reset password requests go through standard OC request infrastructure so it tries to authenticate before sending the request.
The expected behavior is that authentication is not required to reset password.

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