[SOLVED] Get the access token for a customer in my organization

I’m trying to implement two-legged authentication with my nodejs server and my android app. I was able to create a new customer for my organization by making this call (example):

curl -X POST -u "client-id-goes-here:client-secret-goes-here" -d email=abu@agrabahmonkeys.com \
-d no_password=true https://api.particle.io/v1/orgs/particle/customers

And from the response I get the customer’s accessToken. Good. Two questions:

  1. What if my customer is logging in instead of signing up? How do I get an access token for an existing customer in my organization?
  2. In the dashboard, I can’t see the customers I created.

I think I found how. You’re not supposed to retrieve a previously generated access token for a user. Instead, you should create a new one.

$ 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

Source:
https://docs.particle.io/reference/api/#generate-a-customer-scoped-access-token