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

Unhandled Error when the OC API returns a non-json response body. #62

Open
oliverheywood451 opened this issue Apr 2, 2021 · 0 comments

Comments

@oliverheywood451
Copy link

In error situations when OC returns a raw string response body instead of a json response, the sdk method ThrowAuthExceptionAsync throws a not very helpful error "Object reference not set to an instance ....".

Here's code to re-create this error.

>             var oc = new OrderCloudClient(new OrderCloudClientConfig()
>             {
>                 ApiUrl = "https://sandboxapi.ordercloud.io/v1",
>                 AuthUrl = "https://sandboxapi.ordercloud.io/v1",
>                 ClientId = _settings.OrderCloudSettings.ClientID,
>                 ClientSecret = _settings.OrderCloudSettings.ClientSecret,
>                 Roles = new[] { ApiRole.FullAccess }
>             });
> 
>             var token = await oc.AuthenticateAsync();

The "/v1" in the url is incorrect and results in a response "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable." from OC.

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