Trouble with SparkIO.Webservices

Hi,
I have a .net application that has been running for months without issue. It uses SparkIO.Webservices so that it connects to my account and retrieves information published by my devices.

Today it just stopped working and closes without even giving a proper error message. Looking at the code, I found out that it is stopping on this line:

core = New EventsAPI([username], [password], "")

Looking at the parameters that are supposed to be sent to this function I noticed that the fifth argument, when not supplied, defaults to “https://api.spark.io”. I tried changing the argument to “https://api.particle.io”. The effect was that now the application is not closing on it’s own, but the server is returning this error:

The remote server returned an error: (401) Unauthorized.

I am sure there is nothing wrong with my credentials since they have not been changed and I can still access the console with them.

Is anyone else encountering this problem?

Thank you.

UPDATE #1:

The error I am getting after changing the “urlSparkCloud” argument occurs on this line of code:

core.StartPublicEventsByName("{variablename}", True)

UPDATE #2:

Found a temporary solution by changing:

core = New EventsAPI([username], [password], "")

with

core = New EventsAPI([AccessToken])

and

core.StartPublicEventsByName("{variablename}", True) 

with

core.StartOwnedDeviceEventsByName("{variablename}", True)

I got the Access token from the Particle Console but I don’t how long till it expires.

Which library are you using?

There is a param that allows the creation of a non-expiring access token.

This is what I am using:

I believe I found a solution for the access token but I have only been testing it for a day:

MyCore = New CoreAPI("[email]", "[password]", , , "https://api.particle.io")
Dim MyAccessToken As CreateTokenInfo = MyCore.CreateToken("[email]", "[password]")
Dim strAccessToken = MyAccessToken.AccessToken.ToString()
core = New EventsAPI(strAccessToken)