This example uses then-request
, which you can install with npm install then-request
However, any http library will work here.
The Halo Waypoint website requires only a valid "Auth" token/ cookie in order to access their "api."
To get an Auth
token, you have to login to the website. You can try this now just by loggin in at www.halowaypoint.com, and you'll notice that after doing so you get an Auth
cookie. For the past few years this has been the only requirement, so I'm sure it's not going to change anytime soon.
Lucky for you, this Auth
cookie isn't very special, meaning that possibly hundreds can be used at the same time, because each new request to any "private" page on the website gives you a new Auth token to use. This is very good because it means you don't have to use the new Auth tokens! You can keep using the first one you get for a while before Waypoint requires you to login again, however you probably should be updating your token as often as possible, because this may extend the time between logins.
And because this Auth
token isn't special, it means you can use your own account information without worrying about being logged out of your account on your own computer, or your script constantly having to log back in whenever you use your account else-where. After all, this is just OAuth.
The only downside to this is that each login can take multiple seconds, so saving your Auth
token is absolutely essential for production environments. You can easily save the token in a database, and try using it later. If it works, awesome! You'll know when you need to login again because responses will not be valid JSON.
I highly recommend using your own account information, because it will make life much easier for yourself. Just be sure to not put your passwords in the source code!
I hope this helps anyone who looks for it!
Original Gist by @gitFurious: https://gist.github.com/gitFurious/28134b27414297681e29