How to set up active access token

I’m trying to run the ios cloud sdk example app, and it generates this error:
“SparkCloud could not subscribe to devices system events No active access token”

And, before I get hassled by Moore7 :wink: yes I am reading the doc.

But I’m hoping for a quickie solution, to save time.

Anything wrong with what’s written there, or are you looking for something else entirely?

When I run the example app in IOS CLOUD SDK, and tap the “Login” command, calls function loginButton() and then loginWithUser: password: < my pw>
and then I get the error.

I’m studying the doc to figure out how to initialize an “active access token.”

isn’t that mentioned in the link I gave you?

Yes, a few sections down is “OAuth client configuration” which looks like what I need to add access tokens.

I’m confused.
Your link went to Particle docs REFERENCE > COMMON TASKS, which reads:
“You don’t need to worry about access tokens and session expiry, SDK takes care of that for you”.
But the IOS CLOUD SDK example app fails to login and gives me the error:
“no active access token”.

I modified the example app TEST_USER to my email addr and TEST_PASS to my pw (the ones I use to log in compiler) but get the error.

This line seems to be adding the access token:

Which is from this example:

And it corresponds to the information given in the link above.

When I read “If you’re new to Particle iOS SDK feel free to skip this notice” I assumed “notice” meant the following sections 1 through 5 including the all important “4) Two legged auth support / better session handling”.

Okay, I’ll march through 4)…

What’s the difference between that example app and the IOS CLOUD SDK example from the Particle docs GUIDE?
Are we supposed to modify the IOS CLOUD SDK example app to correct it so that it works?

Moors7, I am at a loss for what you suggest that I do. Should I give up on the Particle IOS CLOUD SDK example, and switch to your “spark/spark-setup-ios-example/blob/master/SparkSetupExample-Swift/ViewController.swift” project?

Particle has this great IOS CLOUD SDK example app, that runs on my iphone, and I just want to know how to correct it so that its “Login” and Test sequence" functions work correctly. What do I need to do?

Moors7, thanks for making it work! I don’t know what magic wand you waved, but now it works. It logged in and the Test sequence command now works.

Seriously, gang, all I did was change these lines:

#define TEST_USER   @""
#define TEST_PASS   @"testpass"

…and it still failed. Then I played a game of golf with my son, came back, ran it, and it worked.
(Problem was most probably, my iphone was not connected to my local network).

1 Like