Authenticate API Users
API Key
It's recommended to use the Nue API Key for authenticating API requests to Nue. Please follow the instructions provided here to obtain and configure your API Keys. Once configured, you can use the API keys to authenticate any API calls with Nue.
Here is an example of using the Nue API Key as a header parameter to authenticate into the Nue API:
curl --location --request GET 'https://app.nue.io/api/async/graphql' \
--header 'Content-Type: application/json' \
--header 'nue-api-key: {{nue-api-key}}' \
--data '{"query":"query { \n Customer (where: {id: {_eq: \"ee4d6c55-ec2e-4cea-89eb-0a159edf19b9\"}}) { \n parentCustomerId\n }\n}","variables":{}}'
JWT Token
Optionlly, the client can use JWT token to access Nue APIs. The JWT token will expire in 15 minutes.
Nue authenticates your API requests using your tenant's API Access Key along with an authentication token. If you don’t include your API Access Key (apiAccessKey
) in the request header when making an API request, or use an incorrect one, Nue returns a 401 - Unauthorized HTTP response code.
In Nue, one user can be authenticated into more than one tenants. So Nue uses apiAccessKey
to authenticate an API user into the target tenant. Each tenant has a different apiAccessKey.
Code Example
POST /auth/token
curl --location 'https://api.nue.io/api/auth/token' \
--header 'Content-Type: application/json' \
--data '{
"userName": "{{username}}", "password": "{{password}}", "showTenants": "true"
}'
After getting the access token, the client can access Nue's API with header like
Authorization: Bearer {token}
apiAccessKey: {apiAccessKey}
Refresh Token
POST /auth/refreshToken
Refresh the access token.
Code Example
# You can also use wget
curl -X POST https://api.nue.io/auth/refreshToken \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'apiAccessKey: string'
Basic Auth
You can also use Basic Authentication along with the apiAccessKey
to authenticate into Nue API. For example, to get tenant details, use the following API:
curl -X GET https://api.nue.io/tenant \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Basic {basic_token} \
-H 'apiAccessKey: {apiAccessKey}'