particle-iot / spark-setup-android

Former home of the Particle Device Setup library for Android
Apache License 2.0
23 stars 30 forks source link

Added ability to inject access token #63

Closed gregjesl closed 6 years ago

gregjesl commented 6 years ago

Issue: Method for injecting an access token (for two-legged authentication) was not clear.

Our product uses two-legged authentication; we need to inject the customer's access token into the setup process for claiming. We did not see a clear way to do so. After some digging, we found that the cloud appears here but it is not clear how to set the token.

This pull request adds a static getter and setter to the ParticleDeviceSetupLibrary class for setting the token. If the token is set, then the setup skips the login.

gregjesl commented 6 years ago

An alternative to a static setter and getter would be to overload StartDeviceSetup with an additional argument that is the token to be used.

jensck commented 6 years ago

@gregjesl hey, thanks for the contribution

A simple static method for this is already available though, as shown here: https://docs.particle.io/reference/android/#injecting-session-access-token-two-legged-authentication-

If there's an improvement to be made here, it's probably in our documentation, by increasing awareness of the (intentionally) separate ParticleCloudSDK class.