# \[Solved\] Api.spark.io certificate is expired

**URL:** <https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497>\
**Category:** Troubleshooting\
**Created:** [March 14, 2017, 1:00pm UTC](https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497 "2017-03-14T13:00:00Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![phyo\_tz](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/phyo_tz/32/13581_2.png) [@phyo\_tz](https://community.particle.io/u/phyo_tz)\
**Post date:** [March 14, 2017, 1:00pm UTC](https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497/1 "2017-03-14T13:00:00Z")

</div>

Hello,

I have been using [api.spark.io](http://api.spark.io) to connect with my photons.  
It was fine until today with the error of invalid certificate.  
Apparently, it was expired yesterday.  
If I were to switch to [api.particle.io](http://api.particle.io), I have to update the algorithm accordingly which I hesitate to do so since I am not very familiar with the functions.  
Is there any other option?

Thanks in advance.

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/5/54a638176f2be24e74f2cc1f8d82f4f8af43a004.jpg)

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/6/630dab342eb9b2b49438db9d3b17cc853d13dffd.jpg)

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [March 14, 2017, 1:23pm UTC](https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497/2 "2017-03-14T13:23:12Z")

</div>

@phyo_tz, i believe that domain is not being planned for deprecation so the SSL cert needs to be updated.

Let me check with the team on the plan.

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [March 14, 2017, 1:29pm UTC](https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497/3 "2017-03-14T13:29:18Z")

</div>

Ok, the team will be working on updating the SSL cert for `api.spark.io` . 😉

Will provide an update in the next few hours.

@phyo_tz, what are your concerns from changing to `api.particle.io`? I believe they work the same?

If you have a staging environment, you can try making the change and see if things are breaking.

---

<div class="post-metadata">

**Author:** ![phyo\_tz](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/phyo_tz/32/13581_2.png) [@phyo\_tz](https://community.particle.io/u/phyo_tz)\
**Post date:** [March 14, 2017, 1:30pm UTC](https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497/4 "2017-03-14T13:30:31Z")

</div>

Thank you so much. I look forward to the update. I almost got an heart attack. 😅  
Meanwhile, my cloud functions and others which connects to [api.spark.io](http://api.spark.io) are dying. 😢

---

<div class="post-metadata">

**Author:** ![phyo\_tz](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/phyo_tz/32/13581_2.png) [@phyo\_tz](https://community.particle.io/u/phyo_tz)\
**Post date:** [March 14, 2017, 1:39pm UTC](https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497/5 "2017-03-14T13:39:52Z")

</div>

It is because I wrote the code based on this tutorial in which is using [api.spark.io](http://api.spark.io). And other tutorials were using spark ecosystem at the time of me implementing the code.  
It took me a while (several days) to understand and modify the tutorials to get what I needed.  
Therefore, I am quite hesitating to start the things new again.

[Tutorial link](https://github.com/moors7/particle_device_interface)

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [March 14, 2017, 1:42pm UTC](https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497/6 "2017-03-14T13:42:06Z")

</div>

~~I believe that the change from `spark.io` to `particle.io` would not impact the web interface in the tutorial 😉~~

---

<div class="post-metadata">

**Author:** ![phyo\_tz](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/phyo_tz/32/13581_2.png) [@phyo\_tz](https://community.particle.io/u/phyo_tz)\
**Post date:** [March 14, 2017, 1:57pm UTC](https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497/7 "2017-03-14T13:57:11Z")

</div>

I tried replacing all “spark” with “particle” in my files. But they are shooting me back with this errors. 😭

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/3/3c9cb46348148ceb2721d54e663d4facbd9a56b2.png)

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [March 14, 2017, 2:08pm UTC](https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497/8 "2017-03-14T14:08:52Z")

</div>

Hi @phyo_tz,

Don’t do a simple string replace of the word ‘spark’ to ‘particle’, instead, how about “[api.spark.io](http://api.spark.io)” to “[api.particle.io](http://api.particle.io)”.

Thanks,  
David

---

<div class="post-metadata">

**Author:** ![phyo\_tz](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/phyo_tz/32/13581_2.png) [@phyo\_tz](https://community.particle.io/u/phyo_tz)\
**Post date:** [March 14, 2017, 2:49pm UTC](https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497/9 "2017-03-14T14:49:21Z")

</div>

Hello 😃

I used [this](https://github.com/moors7/particle_device_interface/blob/gh-pages/script.js) code as a base and modified extensively.  
I bypassed the validation process with directly inserting the access token inside the code [which I aware is a bad practise]. I did it as a starting point because I needed to see the device status as I load the page.  
Since I bypassed login process, there is no [api.spark.io](http://api.spark.io) code involved.  
 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/4/4f7bbbfad790dd4676a980503478488741b6e7cd.jpg)  
 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/5/538cf11e9e716ddd754874c83abdda7ef14cb06d.PNG)  
I used several spark functions to retrieve all the data, which I think it is the reason why new particle api is not working as can be seen in below code.

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/5/543dc886303a124179f2460f31eaa7f3a44fe563.PNG)

Thank you.

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [March 14, 2017, 3:14pm UTC](https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497/10 "2017-03-14T15:14:36Z")

</div>

In this code, “spark” refers to a javascript module, it’s probably this file:

```auto
<script src="http://cdn.jsdelivr.net/sparkjs/1.0.0/spark.min.js" type="text/javascript" charset="utf-8"></script>  

```

When I open up that file, I see it’s using the correct url:

```auto
{this.__baseUrl=url}});this.baseUrl="https://api.particle.io";this.clientId="Spark";this.clientSecret="Spark";this.accessToken=null;this.plugins=[];this.devices=[];this.api=new 

```

changing the variable name “spark” to “particle” in your code doesn’t really accomplish anything.

Thanks!  
David

---

<div class="post-metadata">

**Author:** ![phyo\_tz](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/phyo_tz/32/13581_2.png) [@phyo\_tz](https://community.particle.io/u/phyo_tz)\
**Post date:** [March 14, 2017, 3:32pm UTC](https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497/11 "2017-03-14T15:32:11Z")

</div>

![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/2/2afd83b1375c658fb32895f5d31adb0a4ad7a365.jpg)  
 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/1/1a09c9aaa7eba60f6edeb8f12996ae9a85052cc2.jpg)

In the console log (line 286), it is redirecting to [api.spark.io](http://api.spark.io), which is the main cause of certificate error. 😓

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [March 14, 2017, 4:02pm UTC](https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497/12 "2017-03-14T16:02:00Z")

</div>

Hi @phyo_tz,

That’s what I’m saying, you have some bit of code (perhaps in a module / library) with the url: “[api.spark.io](http://api.spark.io)”. You should change that to “[api.particle.io](http://api.particle.io)”.

Thanks,  
David

---

<div class="post-metadata">

**Author:** ![phyo\_tz](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/phyo_tz/32/13581_2.png) [@phyo\_tz](https://community.particle.io/u/phyo_tz)\
**Post date:** [March 14, 2017, 4:24pm UTC](https://community.particle.io/t/solved-api-spark-io-certificate-is-expired/30497/13 "2017-03-14T16:24:54Z")

</div>

Hi Dave,

Per your suggestion, I had been tracing [api.spark.io](http://api.spark.io) in several external js files.  
What happened was that there are duplicates of spark.min.js in serveral locations.  
I was looking for [api.spark.io](http://api.spark.io) in spark.min.js in location 1.  
But I hardcoded **[api.spark.io](http://api.spark.io)** in spark.min.js of location 2.  
Silly me.  
Now I changed back to **[api.particle.io](http://api.particle.io)**.  
Thanks for your suggestions and help, both @Dave and @kennethlimcp.  
Now data are fetching great from [api.particle.io](http://api.particle.io). 😄  
Please update me if there is any update for certificate of [api.spark.io](http://api.spark.io).

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/f/f3f05cd1a96220529c60d449a21d32df6a7f84d6.jpg)

Again, thanks for your time. =D
