Unfortunately none of the customers I make are showing up in my product’s dashboard. Im also trying to access them with the following curl command:
curl -X GET --user clientID:xxxxxclientSecretxxxxx https://api.particle.io/v1/products/productID/customers
The response claimes there is a “malformed auth header” but it is formed the same as when I create a user…
{
“error”: “invalid_request”,
“error_description”: “Malformed auth header”
}
The authentication tab not showing up is somewhat fixed, I can click where it ought to be and get to the page, the icon just isnt visible. Im sure its my cache or something. The more important issue of not being able to list customers is unchanged though. It still just says “malformed auth header”. I also tried treating it like a Bearer token, which I didnt think would make sense, and it failed still.
I believe so. I am using the same 4 digit value I used in the command to make a customer for my product. It says its my productID in the console, not sure what the ‘Slug’ is.
I think it is older term to be honest I would use the ProductID as well. Have you tried with the access_token for your account? Since it complaining about the header maybe it is expecting the auth header with a token instead. I have noticed that OAuth use is usually limited to creating users and tokens then things go back to access_tokens from there. The Docs don’t specify which auth model to use so if you do figure it out I think a docs PR may be appropriate!
When you say “the access_token for your account” do you mean those credentials from the authorization tab or should I use the command outlined here to make an access_token for my developer account: https://docs.particle.io/reference/api/#generate-an-access-token
Just in case that is what you meant, I tried it. I was able to generate an access token using my developer account credentials and the following command:
curl https://api.particle.io/oauth/token -u particle:particle -d grant_type=password -d username=myEmail@email.com -d password=myPassword
When you GET customers, you should be using an access token from your Particle user account. Your second request is not quite hitting the right endpoint, you have:
curl -X GET -H "Authorization: Bearer xxxaccessTokenxxx" https://api.particle.io/v1/products/[productID]/customer
but customer should be changed to customers (plural).
The OAuth Client ID and secret are used to generate access tokens. These access tokens can then be used to make requests against the API
Awesome I think that worked thanks! I knew it would be something small on my end lol.
One last question. It returns what looks like a valid response but is empty. I do have customers created but I dont have any that have devices associated with them. Do customers only show up here, and in the dashboard, after they have devices associated with them?
Is there a tutorial for submitting a PR to update docs.particle.io? I would be happy to add the detail to the Cloud API. The token owner would need to be someone identified as being on the product team correct?