# Curl command for creating a product bearer access token

**URL:** <https://community.particle.io/t/curl-command-for-creating-a-product-bearer-access-token/51826>\
**Category:** Product Creation\
**Tags:** photon\
**Created:** [August 22, 2019, 4:21pm UTC](https://community.particle.io/t/curl-command-for-creating-a-product-bearer-access-token/51826 "2019-08-22T16:21:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![armor](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/armor/32/18398_2.png) [@armor](https://community.particle.io/u/armor)\
**Post date:** [August 22, 2019, 4:21pm UTC](https://community.particle.io/t/curl-command-for-creating-a-product-bearer-access-token/51826/1 "2019-08-22T16:21:01Z")

</div>

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](https://api.particle.io/oauth/token) -u clientID:clientSecret -d grant-type = ??? -d expires\_in = 60000

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [August 22, 2019, 4:27pm UTC](https://community.particle.io/t/curl-command-for-creating-a-product-bearer-access-token/51826/2 "2019-08-22T16:27:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![armor](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/armor/32/18398_2.png) [@armor](https://community.particle.io/u/armor)\
**Post date:** [August 22, 2019, 5:35pm UTC](https://community.particle.io/t/curl-command-for-creating-a-product-bearer-access-token/51826/3 "2019-08-22T17:35:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [August 22, 2019, 5:47pm UTC](https://community.particle.io/t/curl-command-for-creating-a-product-bearer-access-token/51826/4 "2019-08-22T17:47:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![armor](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/armor/32/18398_2.png) [@armor](https://community.particle.io/u/armor)\
**Post date:** [August 22, 2019, 6:28pm UTC](https://community.particle.io/t/curl-command-for-creating-a-product-bearer-access-token/51826/5 "2019-08-22T18:28:59Z")

</div>

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

> curl [https://api.particle.io/oauth/token](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"

---

<div class="post-metadata">

**Author:** ![Joe](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/joe/32/16963_2.png) [@Joe](https://community.particle.io/u/Joe)\
**Post date:** [December 11, 2019, 9:07pm UTC](https://community.particle.io/t/curl-command-for-creating-a-product-bearer-access-token/51826/6 "2019-12-11T21:07:47Z")

</div>


