# Particle Javascript 404 error

**URL:** <https://community.particle.io/t/particle-javascript-404-error/20459>\
**Category:** Troubleshooting\
**Created:** [February 25, 2016, 12:36pm UTC](https://community.particle.io/t/particle-javascript-404-error/20459 "2016-02-25T12:36:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![1inarow](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/1inarow/32/7277_2.png) [@1inarow](https://community.particle.io/u/1inarow)\
**Post date:** [February 25, 2016, 12:36pm UTC](https://community.particle.io/t/particle-javascript-404-error/20459/1 "2016-02-25T12:36:24Z")

</div>

I’m trying to do a simple login with the Particle javascript library but can’t seem to get it to work. I’ve copied directly from the docs and have triple checked that I can login with that account in [build.particle.io](http://build.particle.io) and the CLI.

This is the boiled down code:

```auto

<script type="text/javascript" src="//cdn.jsdelivr.net/particle-api-js/5/particle.min.js"></script>

var particle = new Particle();
particle.login({username: '[my username]', password: '[my password]'}).then(
        function(data){
            console.log('API call completed on promise resolve: ', data.access_token);
        },
        function(err) {
            console.log('API call completed on promise fail: ', err);
        }
);

```

Here is what I get:

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

I pulled everything from [here](https://docs.particle.io/reference/javascript/#client-side).

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [February 25, 2016, 2:13pm UTC](https://community.particle.io/t/particle-javascript-404-error/20459/2 "2016-02-25T14:13:02Z")

</div>

Could you give this a try, seems to work for me?

```auto
<html>
  <head>
    <title>Particle Login Example</title>
	
    <script type="text/javascript" src="http://cdn.jsdelivr.net/particle-api-js/5/particle.min.js"></script>
  </head>

  <body>
    <script>
		var particle = new Particle();
	
		particle.login({username: '[USERNAME]', password: '[PASSWORD]'}).then(
		  function(data){
			console.log('API call completed on promise resolve: ', data.body.access_token);
		  },
		  function(err) {
			console.log('API call completed on promise fail: ', err);
		  }
		);
	
    </script>
  </body>
</html>

```

---

<div class="post-metadata">

**Author:** ![1inarow](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/1inarow/32/7277_2.png) [@1inarow](https://community.particle.io/u/1inarow)\
**Post date:** [February 25, 2016, 2:22pm UTC](https://community.particle.io/t/particle-javascript-404-error/20459/3 "2016-02-25T14:22:49Z")

</div>

@Moors7 -

That works now…but other than excluding the `http://` and not properly navigating the result of the promise I can’t figure out why the original promise failed… I even ran the original code and it no longer errors (even though it returns “undefined” for data.access\_token since that exists in data.body).

I was running this last night ~12 hours ago with the failed result before posting it this morning because I figured it might be a fluke in the system.

On that note, is there an uptime / status for all Particle services somewhere?

---

<div class="post-metadata">

**Author:** ![1inarow](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/1inarow/32/7277_2.png) [@1inarow](https://community.particle.io/u/1inarow)\
**Post date:** [February 25, 2016, 8:22pm UTC](https://community.particle.io/t/particle-javascript-404-error/20459/4 "2016-02-25T20:22:52Z")

</div>

I found the status page btw:  
[http://status.particle.io/](http://status.particle.io/)

Don’t see any issues with logins for yesterday. Glad it’s working now though.

---

<div class="post-metadata">

**Author:** ![1inarow](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/1inarow/32/7277_2.png) [@1inarow](https://community.particle.io/u/1inarow)\
**Post date:** [February 26, 2016, 3:58am UTC](https://community.particle.io/t/particle-javascript-404-error/20459/5 "2016-02-26T03:58:04Z")

</div>

> [@Moors7](#):
>
> [http://cdn.jsdelivr.net/particle-api-js/5/particle.min.js](http://cdn.jsdelivr.net/particle-api-js/5/particle.min.js)

So, I was still having my issue after the fact, but it looks like the cdn version of the javascript file (the one linked in the docs) is out of date and has a bug where it links to `https://api.particle.io/` where it includes an extra "/" at the end of it. Thus, all calls to the api look like `https://api.particle.io//oauth` for example. Removing the slash seems to resolve it, but it's also resolved in the latest on github, so I just pulled that instead:

[https://raw.githubusercontent.com/spark/particle-api-js/master/dist/particle.min.js](https://raw.githubusercontent.com/spark/particle-api-js/master/dist/particle.min.js)
