# Particle user's access token?

**URL:** <https://community.particle.io/t/particle-users-access-token/21538>\
**Category:** Product Creation\
**Created:** [March 28, 2016, 10:04pm UTC](https://community.particle.io/t/particle-users-access-token/21538 "2016-03-28T22:04:17Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtun009](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@mtun009](https://community.particle.io/u/mtun009)\
**Post date:** [March 28, 2016, 10:04pm UTC](https://community.particle.io/t/particle-users-access-token/21538/1 "2016-03-28T22:04:17Z")

</div>

How do I get one for my two-legged authentication of the following:

curl -X POST -H “Authorization: Bearer 1234” -d name=MyApp -d type=installed   
-d organization=my-org [https://api.particle.io/v1/clients](https://api.particle.io/v1/clients)

Do I need to create my own organization first and pay Particle $50/month. I am still in the evaluation stage.

Thanks.

---

<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:** [March 29, 2016, 6:44am UTC](https://community.particle.io/t/particle-users-access-token/21538/2 "2016-03-29T06:44:16Z")

</div>

Have you read any of the threads found via forum search for _two legged_?  
[https://community.particle.io/search?q=two%20legged](https://community.particle.io/search?q=two%20legged)  
Or the docs  
[https://docs.particle.io/reference/javascript/#user-management](https://docs.particle.io/reference/javascript/#user-management)

No useful info in any of them threads?

---

<div class="post-metadata">

**Author:** ![MORA](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/mora/32/8575_2.png) [@MORA](https://community.particle.io/u/MORA)\
**Post date:** [March 29, 2016, 7:47pm UTC](https://community.particle.io/t/particle-users-access-token/21538/3 "2016-03-29T19:47:09Z")

</div>

The documentation is sadly not that great on oauth

> [@Design question: User/password/access token/OAuth client handling?](https://community.particle.io/t/design-question-user-password-access-token-oauth-client-handling/19923/7):
>
> Hi @vwegert, OAuth Clients let you create and distribute software that lets your users log into their Particle accounts via your app. This can be especially useful if you have an organizational product, and you want your own branded app / customer accounts, etc. This is available now, and you can generate your own oauth clients. We’ve been extremely open, and haven’t strictly required official oauth client credentials, but it’s something that might become required (still easy to create a set…

[https://docs.particle.io/guide/how-to-build-a-product/authentication/](https://docs.particle.io/guide/how-to-build-a-product/authentication/)

> Soon (Late August 2015) you will be able to go to the Particle dashboard and click “Create app” to create a client ID and secret.

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [March 29, 2016, 8:16pm UTC](https://community.particle.io/t/particle-users-access-token/21538/4 "2016-03-29T20:16:48Z")

</div>

Oof, old docs! Actually I think @jeiden is working on the oauth GUI soon, sorry those docs are so outdated!

Thanks,  
David

---

<div class="post-metadata">

**Author:** ![mtun009](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@mtun009](https://community.particle.io/u/mtun009)\
**Post date:** [March 30, 2016, 6:31pm UTC](https://community.particle.io/t/particle-users-access-token/21538/5 "2016-03-30T18:31:51Z")

</div>

Thanks. It will be very helpful if someone can write step by step procedure in details. One question I have is do I need to have an origination and pay $55 per month just to test the two legged authentication. Can someone answer this. Or can we have the test parameter for “test organization.?”

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [March 30, 2016, 7:21pm UTC](https://community.particle.io/t/particle-users-access-token/21538/6 "2016-03-30T19:21:37Z")

</div>

Hi @mtun009,

Good question! Actually there’s a great guide on oAuth here:

[https://docs.particle.io/guide/how-to-build-a-product/authentication/#oauth](https://docs.particle.io/guide/how-to-build-a-product/authentication/#oauth)

and api reference documentation here:

[https://docs.particle.io/reference/api/#create-an-oauth-client](https://docs.particle.io/reference/api/#create-an-oauth-client)

You don’t need an org to test this, but you’ll need it if you’re creating customer-tokens / customer-accounts for your users’ devices.

Thanks!  
David

---

<div class="post-metadata">

**Author:** ![mtun009](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@mtun009](https://community.particle.io/u/mtun009)\
**Post date:** [March 30, 2016, 7:48pm UTC](https://community.particle.io/t/particle-users-access-token/21538/7 "2016-03-30T19:48:41Z")

</div>

Hi Dave-Thanks. I did the following two steps:

1. curl [https://api.particle.io/oauth/token](https://api.particle.io/oauth/token) -u particle:particle -d grant\_type=password -d username=my\_particle\_user\_name -d password=myparticle\_acct\_password  
response:

{  
“token\_type”: “bearer”,  
“access\_token”: “xxxxxxxxxxxxxxxxxxxx1”,  
“expires\_in”: 7776000,  
“refresh\_token”: “xxxxxxxxxxxxxxxxxxxx2”  
}

1. curl -d name=MtApp -d type=installed -d access\_token= xxxxxxxxxxxxxxxxxxxx1 [https://api.particle.io/v1/clients](https://api.particle.io/v1/clients)

response:

{  
“ok”: false,  
“errors”: [  
“Organization not found for user’s role”  
]  
}

Does this mean I have to pay $55 per month even in our development and evaluation phase?

Thanks.

---

<div class="post-metadata">

**Author:** ![jeiden](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jeiden/32/15439_2.png) [@jeiden](https://community.particle.io/u/jeiden)\
**Post date:** [March 31, 2016, 4:06pm UTC](https://community.particle.io/t/particle-users-access-token/21538/8 "2016-03-31T16:06:39Z")

</div>

Hey @mtun009,

Jeff here, one of the Particle engineers. A few things here:

- We’re working on a new UI in the Particle Dashboard for creating OAuth clients that should be available within 2 weeks. For now, you can still hit the API directly
- You don’t need to have an organization to create an OAuth client. You can create one just for your user. Check out [the reference docs](https://docs.particle.io/reference/api/#create-an-oauth-client) on creating OAuth clients. You just wouldn’t include an organization slug in the `POST` request. However, if you are planning on building a Particle-powered product that you’d like to manage as a fleet, I would suggest creating an organization and creating OAuth clients for that organization. There is currently a 30-day trial period with the option to cancel anytime. You can always cancel your subscription, and your organization and its clients will still continue to function
- We are in the process of thinking through refactoring our pricing to allow you to create products and organizations without having to pay (up to a certain number of devices). Stay tuned for updates on that

Hope this helps,

Jeff

---

<div class="post-metadata">

**Author:** ![mtun009](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@mtun009](https://community.particle.io/u/mtun009)\
**Post date:** [March 31, 2016, 6:26pm UTC](https://community.particle.io/t/particle-users-access-token/21538/9 "2016-03-31T18:26:40Z")

</div>

hi @jeiden,

Thanks. I can create clientId and sercret but when I try to create customer I got errors. I did the following two steps:

1. 

curl -d name=MtApp -d type=installed -d access\_token= xxxxxx1111 [https://api.particle.io/v1/clients](https://api.particle.io/v1/clients)

Response:

{  
“ok”: true,  
“client”: {  
“name”: “MtApp”,  
“type”: “installed”,  
“id”: “mtapp-597”,  
“secret”: “serectxxxxxx1111”  
}  
}

1. create customer

this format from document:

curl -u my-org-client-1234:long-secret -d grant\_type=client\_credentials -d [scope=customer=jane@example.com](mailto:scope=customer=jane@example.com) [https://api.particle.io/oauth/token](https://api.particle.io/oauth/token)

**what I use:**  
curl -u mtapp-597:serectxxxxxx1111 -d grant\_type=client\_credentials -d [scope=customer=jane@example.com](mailto:scope=customer=jane@example.com) [https://api.particle.io/oauth/token](https://api.particle.io/oauth/token)  
**response:**  
{  
“error”: “invalid\_client”,  
“error\_description”: “Invalid or missing client\_id parameter”  
}

I am sure I am using the parameters in wrong place. the is no specific on the documents either.

Thanks.

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [April 1, 2016, 4:47pm UTC](https://community.particle.io/t/particle-users-access-token/21538/10 "2016-04-01T16:47:34Z")

</div>

Hi @mtun009,

When registering a customer for an org, you should be hitting your org customer endpoint:

POST to -\> [api.particle.io/v1/orgs/YOUR\_ORG\_SLUG/customers](http://api.particle.io/v1/orgs/YOUR_ORG_SLUG/customers)

```auto
email: "customer-email",
password: "customer-password",
client_id: "your_org_oauth_client_name",
client_secret: "your_oauth_client_secret"

```

Thanks,  
David

---

<div class="post-metadata">

**Author:** ![mtun009](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@mtun009](https://community.particle.io/u/mtun009)\
**Post date:** [April 1, 2016, 5:21pm UTC](https://community.particle.io/t/particle-users-access-token/21538/11 "2016-04-01T17:21:49Z")

</div>

> [@mtun009](#):
>
> curl -u my-org-client-1234:long-secret -d grant\_type=client\_credentials -d [scope=customer=jane@example.com](mailto:scope=customer=jane@example.com) [https://api.particle.io/oauth/token](https://api.particle.io/oauth/token)

@dave,

my question is when I use the format below I get the invalid\_client error:

curl -u client-id:client-secret -d grant\_type=client\_credentials -d [scope=customer=customer@customer.com](mailto:scope=customer=customer@customer.com) [https://api.particle.io/oauth/token](https://api.particle.io/oauth/token)

this is from Generate a customer scope access token of the document [https://docs.particle.io/reference/api/#customers](https://docs.particle.io/reference/api/#customers)

Please let me know what am I doing wrong. I don't have my organization registered and I was told I did not need one to test.

Thanks.

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [April 1, 2016, 5:57pm UTC](https://community.particle.io/t/particle-users-access-token/21538/12 "2016-04-01T17:57:34Z")

</div>

Hi @mtun009,

Ahh, I think I’m understanding now. Organizations are a container for customer user accounts and products. You cannot register ‘customer’ accounts without an organization, you can certainly use your non-org oauth account to register normal new ‘user’ accounts, but they won’t be tied to you / your account at all.

You can also register an org for a month for free I believe, if you just want to test.

Thanks!  
David
