Curl command for creating a product bearer access token

photon
Tags: #<Tag:0x00007fe222d54ec0>

#1

I must have done this 8 times but it has been a while since I lasted issued a curl command to get an access token for a new product. I am sure there used to be documentation about how to do this? I am not quite sure of the exact syntax - can someone help please?

$ curl https://api.particle.io/oauth/token -u clientID:clientSecret -d grant-type = ??? -d expires_in = 60000


#2

Have you tried password (the word itself, not your password) as the grant-type?


#3

I haven’t tried anything yet, I seemed to remember that my user id and password were required - I guess it can only not work if wrong - thanks for replying. BTW, do you agree some product related documents have disappeared?


#4

I haven’t looked at the product docs but I noticed that most contents of e.g. Spark Core SPI reference docs have gone, so it’s quite possible that other stuff fell through a rip in the space time continuum.


#5

OK the solution is as follows, you need to be very careful with spaces!

curl https://api.particle.io/oauth/token -u particle:particle -d client_id=oauth_client_id -d client_secret=oauth_client_secret -d “grant_type=password” -d expires_in=9999 -d “username=user_account” -d “password=user_password”