Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset Password Endpoints Require Authentication #40

Open
rminasian opened this issue Jan 23, 2019 · 0 comments
Open

Reset Password Endpoints Require Authentication #40

rminasian opened this issue Jan 23, 2019 · 0 comments

Comments

@rminasian
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant