OAuth client Error

@jonlogan

I tried to create an OAuth client as per:

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

and I get this error:

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

I am using the Access Key from the Setting section of the build.particle.io page where I am logged in using the same email as the the Team member shown on this page: https://dashboard.particle.io/neighbour/team

i.e. I believe the user Access Token is associated with the organisation I am attempting to create an OAuth client for.

@Kevin,

Sorry you’re having issues. Jeff here, one of the Particle engineers. Just to clarify, the cURL request you posted above is a sample. You will need to add your user and organization’s information for this to work. I’m sure you knew this, but just wanted to double check:

organization should be set to neighbour
Authorization: Bearer XXXXX should include a real access token

There is a possibility that the access token that you see in build has not been updated to include the correct permissions. I will direct message you a token that I know has the correct permissions. We are working on an improvement to update all existing access tokens with organization permissions when you create an org, but this is not in production.

Also, I want to ask you which authentication method you are planning to use – Simple or Two-legged? You can find out more about the differences here: https://docs.particle.io/guide/how-to-build-a-product/authentication/#choosing-an-authentication-method

If you are choosing Simple, be sure to pass scope=create_customer when creating your OAuth client. This ensures that your client can only create customers for security purposes

3 Likes

thanks @jeident

Yes, I had replaced the dummy arguments. I have received the new key and I still get the same result. I have reset my access key and also tried with this key - same result.

Now works… a mystery, but I now have my key! Thanks again.

Great news!!! Happy building!!

OK, next step - create a customer. I presume the Bearer token is the same token I used to create the auth client (the one you sent me)? I am now getting this error:

{
“ok”: false,
“error”: “Organization not found.”
}

@Kevin it would be helpful if you posted your exact API call

curl -X POST -H “Authorization: Bearer d91bxxxxxxxxxxefd” -d email=k.xxxx@xxxxxx.com -d no_password=true https://api.particle.io/v1/orgs/particle/customers

@jeiden - any update on this? I am keen to get this resolved so I can continue building the customer on boarding. thank you.

See here for continued discussion: Creating a New Customer (two legged auth) - Now Working