I just finished my prototype with Particle Core(going to upgrade to Photon soon).
Developed an Android app for my product. Put the client ID, client secret and the product ID in my resource file.After that, I implemented a screen to sign up as customer with signUpAndLogInWithCustomer function in Android SDK. Currently I’m successfully creating a customer without errors but there are no customers on my product console after this process. My question is does a customer need to claim a device to appear on my console?
And secondly, after I log in with my customer account I’m claming the Core with claimDevice function(its connected to the cloud while this process taking place and yes, going to use Device Setup Library after I upgrade to Photon). But cant get any publish event via this account. Why? Im claiming it with my customer account without errorrs. I guess I need to claim it with Spark Legacy Tinker app or Device Setup library after I upgrade to photon.
If you are using Simple Auth, the Device Setup (Mobile) library takes care of it for you. You set the product ID, client ID, and client secret in the device setup SDK.
If you are using Two-Legged Shadow Auth, you do need to create the customer and access token. That’s described here:
As long as you can make REST API calls, everything that’s done by the iOS SDK can be done manually from a different environment. However, it’s way more work and as far as I know no one has done it, so a great deal of experimentation will be necessary.
I went to particle console and create the OAuth client Simple authenfication (I have the client id and client secret).
It’s after that I don’t understand.
On the tutorials, they say that the next step is to create the customer. How can the app create the customer if I still don’t know the productId? And even if I manually put it on the command, it says : {“ok”:false,“error”:“Product not found.”}
If you want to walk through the steps of manually creating customers, you should follow the example in the link above. It shows the various tokens you need at each step, where you need to insert the product ID, etc…
Hi! I’ve read all the documentations about android SDK and oauth, but I’m stucked with creating my app.
I’m not familiar with android developing, but i could create a simple app that can connect my photon with devicesetup library to the newtwork and I’m also able to log in to Particle with the app. I don’t understand how could I create a costumer that can access the device’s data that he just connected through the app.
So as far as i understand I have a Particle acc, I’m developing a product and I want to give access to a user only to devices that he’ve connected. I’ve created an ouath client on my console and got the ID and Secret. In the app I called initWithOauthCredentialsProvider() with my oauth arguments, and I logged in with the Particle.logIn() as a costumer with a Particle account made for the costumer. I don’t understand how could the costumer access the Cloud Variables of devices that he set up. I can do the device setup with ParticleDeviceSetupLibrary.init() but this way, the app changes the ownership of the device. If I do this i see Cloud variables, functions etc but only with the costumer’s acc so i can’t update firmware and access the device with the developer acc. If i call ParticleDeviceSetupLibrary.initWithSetupOnly() it only connects the device to my Wifi but the costumer can’t do anything with it. In the auth documentation I read that it claims the device to a costumer in the background but I dont know what Functions should I call to get what I want.
Sorry if anything is unclear but I’m very confused now.
There are four different ways the Device Setup library can be used.
One is non-product, which creates developer Particle accounts. This is essentially what the Particle app does, and is not what you need.
Another is set up Wi-Fi only and not change claiming, which you also don’t want.
For products, there are two different methods:
Simple Auth has the user enter a email and password from within the mobile app, but it creates customer accounts, not Particle developer accounts. You need to assign the productId, oAuth client ID (create customer only), and client secret. The device setup library will create customers for your product on behalf of your product, since it has the oAuth client ID and secret. Note: You cannot use an email that already is associated with a Particle developer account. It will not get associated with your product correctly.
Two-legged auth requires your mobile app communicate with your own back-end service. Your back-end maintains the list of users for your product. Your back-end creates a token for the user’s account and passes this to the mobile app. The mobile app then passes this token to the Device Setup library.
Two-legged is the most flexible method. Since all that is passed to Particle is a token, there is no personally identifiable information needed. Even though a two-legged customer account has a username field which is styled as an email, it really only needs to be unique, not an actual usable email.
Also, when creating two-legged customers, the customer will be invisible until a device comes online the first time. This is normal.
You can find out more of what actually happens behind the scenes when claiming a device here:
Thank you for clearing. So I need the 3rd option you listed, but I didn’t find the way I can do this in my android app. I called ParticleCloudSDK.initWithOauthCredentialsProvider and provided the Oauth client ID and client secret and initialized the device setup library with ParticleDeviceSetupLibrary.init. Than I call the ParticleDeviceSetupLibrary.startDeviceSetup and the setup begins. It asks for a particle account, I assume its the first way you told so it waits a Particle developer account, not a costumer one. I also dont understand where should I provide the product ID. Another question is if I could create a costumer for a product successfully he could access all the devices in that product?