Can you connect 2 different Particle Photon Products to the same iOS app?

I am creating 2 different products using the Particle Photon. For example purpose, lets say the first is a door lock and the second is temp sensor. I have created an iOS App in Swift 3 and have OAuth Simple Authentication working for the first product no problem. Now, I would like to add the second product to that same iOS App. I have created separate customized login portals for each device, but where I am stuck, is that I am using cocoapods-keys to safely store the OAuthClientId and OAuthSecret secrets inside the app for both products, which works great, but I am not sure how to properly change this code in the AppDelegate didFinishLaunchingWithOptions methods to accommodate storing two different ID’s and Secrets, so that on launch the user has access to both of them. Is this even possible? Any ideas? Is there a better way to go about accomplishing this goal?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        
        let keys = MyaccessoriesKeys()
        SparkCloud.sharedInstance().oAuthClientId = keys.oAuthClientId()
        SparkCloud.sharedInstance().oAuthClientSecret = keys.oAuthSecret()
        
        
        return true
    }

Here is the code for the cocoapods-keys in the Podfile as it it now:

plugin 'cocoapods-keys', {
    :project => "myAccessories",
    :keys => [
    "OAuthClientId",
    "OAuthSecret",
    "OAuthClientId2",
    "OAuthSecret2"
    ]}

@ido could you take a look at this?

You can easily create/configure another set of keys in cocoapods-keys and just call:

    let keys = MyaccessoriesKeys()
    SparkCloud.sharedInstance().oAuthClientId = keys.oSecondAuthClientId()
    SparkCloud.sharedInstance().oAuthClientSecret = keys.oSecondAuthSecret()

anywhere in you code (doesn’t have to be in the AppDelegate necessarily).

FYI - this is not a requirement, you can use the same OAuth client/secret for creating access tokens for both of your products, especially if its done from the same mobile app.

Ido,
I know this is an old thread, but I wanted to update it, in case anyone else ran into this issue. Regarding your FYI. I have never been able to use the same OAuth client/secret for multiple products. I don’t know if you guys changed something on the backend, but nothing I tried worked that way. I really would like to get it working with both products using the same client/secret, which would solve my next question. I HAVE been able to get this working using multiple client/secrets, however, the thing I am concerned about, is that setting the client/keys on launch in the app delegate allows for me to navigate to any view controller with client/secret already set, but if I use multiple client/secrets, I then would have to reset which client/secret to use throughout the workflow, which seems like it will lead to problems, especially accessing both products from the same ViewController. SparkCloud.sharedInstance() does not appear to allow for an array of clients/secrets, which is the limiting factor here from my understanding. Either I am missing something here in my understanding of how cocoa pods-keys works, or there is a better way that I am not thinking of. Any input would be helpful. Thank you.

I would need to be able to do something like this if I can’t use the same client/secret for multiple products:

SparkCloud.sharedInstance().oAuthClientId = [keys.oFirstAuthClientId(), keys.oSecondAuthClientId()]
SparkCloud.sharedInstance().oAuthClientSecret = [keys.oFirstAuthSecret(), keys.oSecondAuthSecret()]

P.S. - I know this is unrelated, but what size should the brandImage Icon be? Having issues with Xcode 8.3 with brand image no appearing correctly. It keeps scaling incorrectly.