@Kevin were you able to get this working? Your cURL request looks good. scope is the key and customer=customer@example.com would be the value of the query param for use in a form.
If you are still having problems, DM me your org name, customer email, and client ID you are using and I can look into it more.
Hi there, I am getting the error āOrganization not found.ā when trying to create a customer using curl. After reading above, I think Iām probably entering my organization in the URL incorrectly.
Can someone please tell me where I can find my ā:orgSlugā?
Your confusion is totally valid ā in our recent update to the console, we have since abstracted the concept of organizations from the front-end. If you created the product pre-console, then you created an organization and set its name. The slug would just be the downcased and dasherized version of the name (i.e. āJeff Organizationā => ājeff-organizationā).
If you just created your product, the slug of the organization is the same as the slug of the product. You can find this in the console, when you navigate to any product-specific URL. It is the downcased/dasherized version of the product name + the product version. For example, on the devices page for a product called āFooā with version āv1ā, the URL would look like: https://console.particle.io/foo-v1/devices, and the slug would be āfoo-v1ā.
Adding a customer via the API now seems to work for me, with a response similar to what I was expecting. However, even after waiting a day to update, I still cannot see any of the added customers in the console. Is there something Iām missing?
The customers will actually appear when they have claimed ownership of a device. This is definitely confusing, and something we have a ticket to improve. It would make more sense to show those customers as soon as they are created.
For now though, claim a product device and youāll see the customer appear.
Sorry to exhume this post. Iām working through this process for simple auth. My end goal is to get a basic prototype going destined for an ionic app (angular). I am having trouble working out the curl commands to go through creating a client; customer; token etc in an effort to gain a clear understanding of what all the steps are. There is great information but itās scattered between the guide, the reference and the community forum. Take this post. This is the only reference anywhere that explains what organization is, or where to find it. However, copying the string straight from the browser console, when I try:
curl: (6) Could not resolve host: organization=mXXXXp-v1
although it does return an otherwise sensible looking object:
{
āokā:true,
āclientā:
{
ānameā:āIonicMobileAppā,
ātypeā:āinstalledā,
āsecretā:ā1234ā,
āidā:āionicmobileapp-8868ā
}
}
Iām more from the hardware world, so I know much of this may seem obvious. I donāt suppose anyone could point me at a guide that might help. Itās just not fitting together. ANd after this Iāll have to figure out how to squeeze this into Angular 2 for more fun and games?
Unless someone has done this in Angular 2 already. Would be nice to cut out the middle man!
Edit to my own question, in the hope that this might be helpful for others.
If like me, you're having trouble creating customers or tokens, with errors like: {"ok":false,"error":"Organization not found for user's role."} or {"ok":false,"error":"Not Found"} refer to rickkas7 s post. There is an very succinct explanation of tokens and scope, which is not covered in the documentation.
Iām trying to get a product through initial prototyping but Iām struggling with the js api. I used a test email address to create an account and claim a device etc etc to test out the process. All worked fine. Iām now expanding it into an ionic app. But as soon as I enter a new ātestā email address pretending to be a new customer, I run into problems. If I create a user with the product client id & secret (with limited scope), that works. This is the method given in the docs. But I canāt subsequently login as that user using the same client id & secret? (Why is this?) Strangely, I can log in using id+secret=particle-api or anything else for that matter. But the killer is that I canāt then generate a claim code, at all?! Whatās going on? This is so confusing. I would expect to create a Particle object; pass my product specific client credentials into the constructor and use this for everything. What reason if any is there to use blank/generic client id&secret. And is there a case where more than one Particle objects will be needed within an app?
Iām using ionic by the way, so as far I can gather, I need to use the restricted scope client credentials approach. Iāll keep working on it in the meantime, but Iād really appreciate some expert advise.
@monkey ā as always, specific code snippets will help our team get a better understanding of where the problem lies.
Iām not exactly sure how your requests look, but Iāll recap the process from our docs. After a customer (remember that customers are different than users) is created and the device claimed, the only remaining piece is authenticating API requests correctly to interact with that customersā devices. To do this, youāll need to generate access tokens scoped to the customer. This will allow you to do things like call a function, check a variable, etc. on behalf of the customer from your server or mobile/web app.
Yes, it works! Customers are different than users. Because the notion of customers was not included in the javascript api, I made the assumption / oversight that users were equivalent to customers. Having corrected that assumption, it now works. Thanks.