Now I’m building the mobile application using the SDK. The login of the mobile application is made against my own server. Once the client is logged the idea is to use the SDK for capturing variables, call functions and configure devices. Reading the documentation you need to create the strings which specifies “oauth_client_id”, “oauth_client_secret”, “organization_slug” and “product_slug” but How I can log into the Particle cloud with the SDK? I ask this because the method requires password eg particleCloud.logIn ("ido@particle.io", “l33tp4ssw0rd”);. When the customer is created in this type of authentication is not created with password:
@ruframapi if you’re still getting the login activity even after calling setAccessToken(), that’s a bug. I’m going to be refactoring some of this code very soon, so it should be fixed in the next couple weeks.
I’m running into the same problem… basically trying to figure out how to integrate two-leg authentication within an android app.
Can anyone shed some light on where I would even include the particleCloud.setAccessToken() function in relation to the sample apps (either SDK or Setup)?
Sorry if my question is too beginner but I’m just trying to figure out where to even get started with this. Any more insight into understanding the flow of the applications would be great
@reado You can call ParticleCloud.setAccessToken() right after you initialize the SDK.
I’m working on a few TODOs for Electron setup right now, but after those are done I’m going to be working on auth issues, including a brief addition to the docs on how to integrate 2-leg auth. Thanks for your patience, everyone.
I just tried this and I wasn’t able to reproduce it. Can anyone here try cloning the cloud SDK repo and trying the example app?
Once you have the example app building, open up LoginActivity, comment out the logIn() call, and replace it with this:
// the date below is arbitrary. you can copy & paste it into the example code
// without worrying about your actual token expiration date
sparkCloud.setAccessToken("YOUR ACCESS TOKEN HERE", new Date(1461456951753L));
…and then try whatever SDK calls you want to make after that, and see what you get?
E/Async: Error calling API: activation code was empty
io.particle.android.sdk.cloud.ParticleCloudException
at io.particle.android.sdk.cloud.ParticleCloud.generateClaimCodeForOrg(ParticleCloud.java:281)
at io.particle.android.sdk.devicesetup.ui.GetReadyActivity$3.callApi(GetReadyActivity.java:114)
at io.particle.android.sdk.devicesetup.ui.GetReadyActivity$3.callApi(GetReadyActivity.java:109)
at io.particle.android.sdk.utils.Async$AsyncApiWorker.doInBackground(Async.java:105)
at io.particle.android.sdk.utils.Async$AsyncApiWorker.doInBackground(Async.java:73)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Sorry for the delay on this – I’ve had a couple urgent issues come up that I had to address first. I’ll be working on this tonight and will offer an update then.