850 octets ajoutés
, 6 janvier 2015 à 07:10
{{Spark.IO-Could-API-NAV}}
== Authentification ==
Just because you've connected your Spark Core to the internet doesn't mean anyone else should have access to it. Permissions for controlling and communciating with your Spark Core are managed with OAuth2.
<nowiki># You type in your terminal
curl https://api.spark.io/v1/devices/0123456789abcdef01234567/brew \
-d access_token=9876987698769876987698769876987698769876
# Response status is 200 OK, which means
# the Core says, "Yes ma'am!"
# Sneaky Pete tries the same thing in his terminal
curl https://api.spark.io/v1/devices/0123456789abcdef01234567/brew \
-d access_token=1234123412341234123412341234123412341234
# Response status is 403 Forbidden, which means
# the Core says, "You ain't the boss of me."
# LESSON: Protect your access token.</nowiki>
{{Spark.IO-Could-API-TRAILER}}