# Accesstoken from client credential

**URL:** <https://community.particle.io/t/accesstoken-from-client-credential/25806>\
**Category:** General\
**Created:** [September 13, 2016, 3:44pm UTC](https://community.particle.io/t/accesstoken-from-client-credential/25806 "2016-09-13T15:44:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![privatejava](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/privatejava/32/11605_2.png) [@privatejava](https://community.particle.io/u/privatejava)\
**Post date:** [September 13, 2016, 3:44pm UTC](https://community.particle.io/t/accesstoken-from-client-credential/25806/1 "2016-09-13T15:44:43Z")

</div>

Hi,  
Is it possible for us to generate accesstoken by only using the client name and client secret. ?

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:** [September 13, 2016, 6:25pm UTC](https://community.particle.io/t/accesstoken-from-client-credential/25806/2 "2016-09-13T18:25:50Z")

</div>

Something like this?  
[https://docs.particle.io/reference/api/#generate-an-access-token](https://docs.particle.io/reference/api/#generate-an-access-token)

---

<div class="post-metadata">

**Author:** ![privatejava](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/privatejava/32/11605_2.png) [@privatejava](https://community.particle.io/u/privatejava)\
**Post date:** [September 13, 2016, 6:27pm UTC](https://community.particle.io/t/accesstoken-from-client-credential/25806/3 "2016-09-13T18:27:49Z")

</div>

But it says i can only generate by using the user and password of particle but not client name and secret.  
Seems like username and password is essential for access token generation.

---

<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:** [September 13, 2016, 6:30pm UTC](https://community.particle.io/t/accesstoken-from-client-credential/25806/4 "2016-09-13T18:30:49Z")

</div>

What do you mean with “client”.

Are you refering to a customer account of your product or your own developer account?

---

<div class="post-metadata">

**Author:** ![privatejava](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/privatejava/32/11605_2.png) [@privatejava](https://community.particle.io/u/privatejava)\
**Post date:** [September 13, 2016, 6:32pm UTC](https://community.particle.io/t/accesstoken-from-client-credential/25806/5 "2016-09-13T18:32:26Z")

</div>

I created one oauth client for a product. i wanted to see what are my access token for oauth client only And it seems some api doesn’t allow to do request unless we provide access token. However most of the api end points supports for the Client name, secret as Header Authorization .

---

<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:** [September 13, 2016, 6:37pm UTC](https://community.particle.io/t/accesstoken-from-client-credential/25806/6 "2016-09-13T18:37:18Z")

</div>

I see, then I’ll hand over to @jeiden 😉

---

<div class="post-metadata">

**Author:** ![privatejava](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/privatejava/32/11605_2.png) [@privatejava](https://community.particle.io/u/privatejava)\
**Post date:** [September 13, 2016, 6:38pm UTC](https://community.particle.io/t/accesstoken-from-client-credential/25806/7 "2016-09-13T18:38:34Z")

</div>

Thank you . I will probably check replies tomorrow 🙂 Because it is late night here and Happy programmer’s day !

---

<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:** [September 19, 2016, 4:28pm UTC](https://community.particle.io/t/accesstoken-from-client-credential/25806/8 "2016-09-19T16:28:24Z")

</div>

@privatejava – Check out the authentication docs here: [https://docs.particle.io/guide/how-to-build-a-product/authentication/#7-interact-with-customer-39-s-device-1](https://docs.particle.io/guide/how-to-build-a-product/authentication/#7-interact-with-customer-39-s-device-1).

Your request should look something like this:

```auto
curl -u my-org-client-1234:long-secret -d grant_type=client_credentials \
-d scope=customer=jane@example.com https://api.particle.io/oauth/token

```

Breaking this down:

- The `-u` is a HTTP Basic Auth header, where you will pass your OAuth client ID and secret. This allows you to generate access tokens for customers that belong to your product
- `grant_type` is the OAuth grant type, which in this case is client\_credentials
- `scope` is set to customer, and what allows you to specify the customer you’d like an access token for. The value of customer should be set to the email you passed when creating the customer.

---

<div class="post-metadata">

**Author:** ![privatejava](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/privatejava/32/11605_2.png) [@privatejava](https://community.particle.io/u/privatejava)\
**Post date:** [October 6, 2016, 5:40pm UTC](https://community.particle.io/t/accesstoken-from-client-credential/25806/9 "2016-10-06T17:40:56Z")

</div>

Awesome !! Thank you
