Error: "Organization not found for user's role" when using "particle" authentication


@ido - I found the issue. I was using incorrect values for oauth_client_secret and oauth_client_id. Thanks for your time.


Hello @ido, I have added a product in my organisation and done the required changes such as client id and client secret id and product slug in my android code , even though i am receiving the error “organisation not found for user role” during creating the new customer account . What changes am i missing ? Please guide
Secondly, How will i come to know my organisation slug name from my console window?


I am also looking for more information on where the org slug can be found. Can a dev please reply? @ido I have a free prototype account but not sure if that qualifies.


Hi Sorry I missed the original post.
We no longer use “org slugs” but product IDs which is just a short number - the SDKs have been adapter to accept this number instead of the org slug string - you can find this number next to the little key icon in the product page in the console.

Are Organization Slugs & Ids Deprecated?

@ido unfortunately device setup / example app requires an org slug , and product slug. so commenting out either of these parameters in customization.xml is a no go. so i specified the product id in both the prod and org slug fields.

this results in a post to the following URL:
HTTP POST with an auth bearer token, and this results in an HTTP 404 (not found error). note that mypid above is where i specified my product id.

Here’s the top of the exception for context:

03-20 21:38:16.484 15356-15356/io.particle.devicesetup.exampleapp E/Async: Error calling API: Organization not found.


Let me loop our Android engineer and get back to you


ok, thanks @ido appreciate that. I also opened a support ticket, but the support engineer mentioned he would wait to see a reply here.


I Set

   <bool name="organization">true</bool>
    <integer name="product_id">mypid int here</integer>

and set the following two string resources in customization.xml in devicesetup app:

    <string name="oauth_client_id">mygeneratedClientID</string>
    <string name="oauth_client_secret">myGeneratedClientSecret</string>

@ido here’s the actual exception after importing the latest changes from the github repo:

04-04 20:49:16.022 27693-27693/io.particle.devicesetup.exampleapp E/Async: Error calling API: Organization not found for user.
at android.os.AsyncTask$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$


@julius Can you look into that?


i tried going into the New User flow for the example app, and I get a different error:
04-04 21:13:24.535 18900-19490/io.particle.devicesetup.exampleapp D/Retrofit: {“ok”:false,“code”:400,“error”:“email was empty”}

now I get the following exception, I added a log statement to CreateAccountActivity right before ParticleCloud was called to make sure the app was grabbing the email addr value from the email field:

log.d("email: " + email);
particleCloud.signUpAndLogInWithCustomer(signUpInfo, getResources().getInteger(R.integer.product_id));

I got this in the monitor log, for my debug statement, so does your SDK have a defect?
Socket deconnection
04-04 21:13:24.041 18900-19490/io.particle.devicesetup.exampleapp D/CreateAccountActivity: email:

04-04 21:13:24.538 18900-18900/io.particle.devicesetup.exampleapp E/Async: Error calling API: email was empty
at android.os.AsyncTask$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$

Here’s the post, I don’t see the email field in the body:

04-04 21:13:24.047 18900-19490/io.particle.devicesetup.exampleapp D/Retrofit: Authorization: Basic
04-04 21:13:24.047 18900-19490/io.particle.devicesetup.exampleapp D/Retrofit: Content-Type: application/json; charset=UTF-8
04-04 21:13:24.047 18900-19490/io.particle.devicesetup.exampleapp D/Retrofit: Content-Length: 195
04-04 21:13:24.047 18900-19490/io.particle.devicesetup.exampleapp D/Retrofit: {“account_info”:{“business_account”:false,“company_name”:"",“first_name”:“LC”,“last_name”:“LC”},“grant_type”:“client_credentials”,“password”:“password”,“username”:“”}
04-04 21:13:24.047 18900-19490/io.particle.devicesetup.exampleapp D/Retrofit: —> END HTTP (195-byte body)


So i took some screencaps of some http header traces using fiddler. I was able to set a breakpoint onBeginRequest with fiddler, and manually tamper the request to add the email field, after which, the request succeeded. This is a confirmed defect in your api. @julius @ido

I added a comment: here.
and opened:

BTW, I can login as the user now (to Tinker for example) but the user doesn’t appear in my ORG’s console under customers. Should the 201 create on the post request to api/v1/products/orgid/customers have added that user to my org’s console?


@Lcstyle I missed a fact that customer signup has extra email field, I’ll be adding that back in next cloud sdk release.


@julius naturally the next question is what’s your ETA, I ported the project and will probably add a fix and then build my local project with my version of the SDK, no need for me to do all that if your next cloud sdk release will happen soon.


@Lcstyle Either end of this week or beginning of next one.


@julius I fixed it in this commit:

won’t issue a pull request as you’ll probably want to clean up the fix, I did test it and it did work:

04-05 14:27:06.506 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: —> HTTP POST
04-05 14:27:06.506 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: Authorization: Basic
04-05 14:27:06.506 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: Content-Type: application/json; charset=UTF-8
04-05 14:27:06.506 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: Content-Length: 225
04-05 14:27:06.507 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: {“account_info”:{“business_account”:false,“company_name”:"",“first_name”:“xyz”,“last_name”:“xyz”},“email”:“emailaddr”,“grant_type”:“client_credentials”,“password”:“xyz”,“username”:“xyz”}
04-05 14:27:06.507 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: —> END HTTP (225-byte body)
04-05 14:27:06.994 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: <— HTTP 201 (487ms)
04-05 14:27:06.994 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: date: Wed, 05 Apr 2017 18:27:06 GMT
04-05 14:27:06.994 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: content-type: application/json; charset=utf-8
04-05 14:27:06.994 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: content-length: 161
04-05 14:27:06.994 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: server: nginx
04-05 14:27:06.994 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: access-control-allow-origin: *
04-05 14:27:06.994 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: etag: W/"a1-GYFWM+qvaGzKzoREA+5Oew"
04-05 14:27:06.994 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: OkHttp-Sent-Millis: 1491416826624
04-05 14:27:06.994 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: OkHttp-Received-Millis: 1491416826994
04-05 14:27:06.995 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: {“token_type”:“bearer”,“access_token”:“AT”,“expires_in”:7776000,“refresh_token”:“RT”}
04-05 14:27:06.995 3714-3780/io.particle.devicesetup.exampleapp D/Retrofit: <— END HTTP (161-byte body)

BTW, the users are not being added to my console under customers:

Can someone help me troubleshoot that? Does the customer need to complete device registration before they are added to the console? See screenshot below, technically, I’ve added two customers so far.


@Lcstyle Released cloud sdk and device setup library updates fixing missing email field bug.