Product Team members can't generate claim code (Android)

Hi guys,

I’m stuck on the following issue: My Android device setup app works fine for customers but not for the product team. For product team members, creation of the claim code fails with message "Organization not found for user."
If I remove an account from the team list, that account works fine again in my app, i.e. generating claim code and subsequent steps work fine.

The logcat for the transaction (http_log_level FULL, sensitive info replaced):

—> HTTP POST https://api.particle.io/v1/products/XXXX/device_claims
Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Content-Length: 24
blank=okhttp_appeasement
—> END HTTP (24-byte body)
<— HTTP 404 https://api.particle.io/v1/products/XXXX/device_claims (206ms)
date: Sat, 23 Sep 2017 22:34:14 GMT
content-type: application/json; charset=utf-8
content-length: 55
server: nginx
x-request-id: cd7c8c49-91f2-48dd-9bb3-8bb2435b9a2d
access-control-allow-origin: *
OkHttp-Sent-Millis: 1506206055154
OkHttp-Received-Millis: 1506206055344
{“ok”:false,“error”:“Organization not found for user.”}
<— END HTTP (55-byte body)
Error calling API: Organization not found for user.
io.particle.android.sdk.cloud.ParticleCloudException
at io.particle.android.sdk.cloud.ParticleCloud.generateClaimCode(ParticleCloud.java:468)
at io.particle.android.sdk.devicesetup.ui.GetReadyActivity$1.callApi(GetReadyActivity.java:121)

I’m using device setup library 0.4.9.

I’ve set productMode in customization.xml (actual id replaced by XXXX):
false
true
XXXX

And I have my product’s Oauth credentials set in oauth_client_creds.xml (actual id and and secret replaced):

ABCD-1234
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

On the console side I have the following settings:

White Label No
Authentication Particle
Login Reuse Yes
Data Hosting Yes
Private Beta No
Account Sharing No
Multiple Sharing Access Levels No
Customer API Access Yes
Reprogrammable Devices Yes
Third-Party API Access No

What am I missing? Any help is much appreciated.

Best regards,
Ruben.

I should add that I see this problem (claim code generation failure for Team Members) with a clean git clone of spark-setup-android (0.4.9), the only changes being the following lines in customization.xml:

<bool name="productMode">true</bool>
<integer name="product_id">*my_product_id*</integer>

<string name="oauth_client_id">*my_client_id*</string>
<string name="oauth_client_secret">*my_client_secret*</string>

I would like to come to a setup where I can use the same account to build+flash firmware and to interact with the device through my android app. I thought that’s what the Team Member concept was about.
Is it better not to use product mode while doing active firmware development?

Any help is much appreciated.

Best regards,
Ruben.

@rlysens, did you ever get a solution for this problem? I am having a similar if not the same problem, I am getting the same <— HTTP 404… Error calling API: Organization not found for user.

I am not able to create account with the product mode enable which work fine in IOS just not Android.

Any update will be great.

Hi Sheng,

I opened a help desk ticket for this issue and got the following response from Particle tech support:

"Yes, you cannot claim a product device as a team member for the product. I’m not sure if it’s a bug or intended feature, but I’ve run into the problem and indeed it does not work. It’s not specific to Android, I think it’s a cloud limitation.

The best solution is to use separate accounts for claiming the device as a customer. It’s a better approximation of how customer accounts will behave, anyway, but it also eliminates the problem claiming as a team member."

Cheers,
Ruben.

@rlysens, Thank you for the reply. How did you create your create account screen for the product mode? Is it base off of tinker app or is it custom? We redid our log in and create account screen, even with a separate account for claiming give the error called. Maybe I am missing something in the code.

I used the device setup library, with a few tweaks. I recall (this was a year ago) that I had to make some changes to get product mode to work. I probably should have reported these as bugs back to Particle. These issues might well be fixed by now. I haven’t resynced in a while.
Here is the Particle’s device setup library:


Here is my code base:

Note that I currently have disabled Product Mode, because of this claim code limitation, but my ‘fixes’ (not confirmed by anybody except myself) for Product Mode are still in there.
I will resync with the latest device setup library. If any of my fixes still apply I’ll report those to Particle.

Cheers,
Ruben.

Hi Ruben,

Thank you for sharing, I been struggling with Android app with product mode, it seem its complaining on the product api endpoint. The odd thing is my IOS app work fine with the product mode enable. Seem like Android is mad beast compare to IOS. LOL

Hoping your fixes will resolve my error. Crossing my fingers.