Accesstoken from client credential

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

Thanks

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

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.

What do you mean with “client”.

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

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 .

I see, then I’ll hand over to @jeiden :wink:

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

1 Like

@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.

Your request should look something like this:

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.
2 Likes

Awesome !! Thank you

1 Like