iOS App Getting Access Token and Device ID for active core in App?

I have to define the Access Token and Device ID for my ios app but I dont want to enter it manually. My app works with my core but I want to just have the Access Token and Device ID for any core I could connect with my app.

Is there a way to do this without having another GET API request for Access Token and Device ID?

I’m not sure if I understand the question:

If you don’t want to enter information, and it can’t retrieve information, then how is the app supposed to get its data?
At some point, you’re going to need an accesstoken in order to control your Core. Either you supply that token, or you log in using your credentials, at which point you can get your accesstoken. Much like the accesstoken, you can then also retrieve information about your Cores, using that accesstoken.

Yes I understand that at some point you will need to get the access token. I am using the spark core ios app and changing it. My question is more is the Access Token and Device ID already saved somewhere in the ios spark app. Such as the active core device iD and Access Token

According to the information that accompanies it on GitHub:

I’d suggest looking into those files for the relevant information. Perhaps @zachary can be of assistance as well(?)

1 Like

From what I can see, the access-token is saved as keychain item, meaning that what is mentioned as account information in the docs from GitHub is in fact here an access-token.
If there is none stored so far, the app generates its own token with the client-ID “spark”.
As consequence, because every iOS-app has ist own keychain, your app generates a new token on first launch (It happens in SPKUser.) and you probably want to change your ID to a more signifikant one.

Thank you. I think this will work:

@property (nonatomic, strong) NSString *userId;
@property (nonatomic, strong) NSString *password;
@property (nonatomic, strong) NSString *token;