Not seeing stream of events with claimed user's token


#1

I have a two legged auth infrastructure. My web server uses OAUTH credentials when creating customers within the product. When creating new devices it uses a particle access token for a master user who was already created within this product (this seems to be required as this endpoint doesn’t take OAUTH). The customer is then assigned the device. I can tell that this all happens correctly, by viewing the Particle console, where the customer’s ID is assigned to the device and the device is viewable within my Product.

Generally this has worked well, but for some reason right now my users cannot see their stream of events. They are using the stream API endpoint in the format of:

curl “https://api.particle.io/v1/devices/DEVICE_ID/events?access_token=CUSTOMER_SCOPED_TOKEN_FOR_CUSTOMER_OF_PRODUCT

In this case I do not see any of the users’ events that I can see in the particle console.

If I use the form of:

curl “https://api.particle.io/v1/products/PRODUCT_ID/devices/DEVICE_ID/events?access_token=CUSTOMER_SCOPED_TOKEN_FOR_CUSTOMER_OF_PRODUCT

I get an error: {“ok”:false,“error”:“Organization not found for user’s role.”}

If I use the form of:

curl “https://api.particle.io/v1/products/PRODUCT_ID/devices/DEVICE_ID/events?access_token=ACCESS_TOKEN_FOR_MASTER_USER_BELONGING_TO_PRODUCT

Then I see the events…

Why can’t the user customer see his own events in this case with the first format I described above?

I’d be happy to give actual values to a Particle.io employee if it helps.


#2

I’ve verified that using an access token from a team member of my product does allow me to see the events, but using a customer scoped token of the actual claimed user of a device I cannot see the events? This seems broken. Also, this used to work, did something change with our Particle deals with scoping of tokens in the last couple days?

I should also say that my customer scoped tokens do allow me to fetch device information. So it seems they are only not allowed to see events in the event stream for some reason?


#3

Ok, so strangely, I re-flashed my firmware (same firmware) and it just started working… Don’t know if somehow the keys got messed up, but all seems fine now :-\