Goal is to add an installs badge to display the number of downloads/installs for particle.io libraries. The API endpoint is here and requires authentication via a personal access-token.
I'd like to take a stab at it but am not sure how to really integrate/require credentials. I think there is a tutorial somewhere, or I'll dive into the source on one of the other badges that requires them. Any help/input would be appreciated!
Hi! Thanks for the suggestion + your interest. Could you clarify: what does the personal access token provide access to?
We do have a good tutorial: https://github.com/badges/shields/blob/master/doc/TUTORIAL.md
The personal access token is required to make any calls to the Particle.io API as described here. With the token, you can then call the libraries endpoint and retrieve the number of installs/downloads.
Thanks for the link to the tutorial; I was reading through it a couple nights ago and noticed the "Querying an API with Authentication" section was still listed as TODO. I figured I would check to see if there were any existing badges that used authentication and try to follow that.
Yea… we don't have a good set of guidelines for that. The policy has been not to accept badges with secure authorization in the URL for security reasons, which makes sense, though, as with most projects, that policy hasn't been applied consistently. A couple have snuck in.
If we could verify that tokens are read-only and narrowly scoped, I'd be comfortable with it.
Another option is to provide the token in the server config, so people who self-host can use it.
Hmm. Those are good points. As far as I know, they don't have different scopes for their access tokens; they're tied to your account and whatever you are able to do, which seems a bit odd. I'll reach out to them to see if they can offer a token-free endpoint for this (should be) public information.
This could be handled similarly to the Wheelmap badge.
I'll try and tackle this sometime next week unless someone else jumps on it first.
Let us know if you have any questions! Either here or in the #contributing room on discord :)
Most helpful comment
I'll try and tackle this sometime next week unless someone else jumps on it first.