CreateCustomer nodeJS SDK

Hey guys, just wanna say thanks for the great hardware!

I have a NODEJS App (using that sdk). that serves and the customers main access point. I have created a couple oauth client credentials and I have successfully set them and I can login using loginAsClientOwner.

But when I try and createCustomer, the API responds with permission denied and invalid scope. This happens with FULL permissions as well as CREATE CUSTOMER permissions.

Also I made sure that I AM sending the client credentials to the API.

Any input or idea would be super helpful.

Thanks for any response.

particle_customer_api_issue__3

The client_id and client_secret for a POST to the customer endpoint (create customer) go into the HTTP basic authentication parameters, not to the POST body JSON.

i dont want to disagree with you but, but by the way the NODEJS SDK is written, the OAuth client_id and client_secret DO go in the body.

otherwise the SDK is written wrong.

The documentation suggests it is required if the Authorization header is not included.

I appreciate your response, thanks!

You’re right. It can go in either location. Not sure why it’s failing in that case.

Oh. wait. Are you trying to create a customer or log in as an existing customer?

If you are creating a customer there should not be a grant_type.

thats not how createCustomer is written ?
Im trying to use the SDK and its failing, so im trying to trouble shoot how to use the API, but no matter how i go about it, i get permission denied…

disclaimer, im not good at style this …

Solution:

You Must Create a OAuth Client Credentials ASSOCIATED WITH A PRODUCT.

Create a product, select it, THEN go to Authentication and create OAuth Client Credentials.

now I feel like if the two are ALREADY associated why do i need to send the product id at all?

thanks for the help!

there needs to be a step added here
Image from Gyazo