https://github.com/auth0-samples/api-quickstarts-tests
Test scripts for API Quickstarts
https://github.com/auth0-samples/api-quickstarts-tests
Last synced: 11 months ago
JSON representation
Test scripts for API Quickstarts
- Host: GitHub
- URL: https://github.com/auth0-samples/api-quickstarts-tests
- Owner: auth0-samples
- License: mit
- Created: 2018-06-13T18:13:56.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-19T14:53:27.000Z (over 2 years ago)
- Last Synced: 2024-04-10T16:07:51.572Z (about 2 years ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 1
- Watchers: 24
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# API Quickstart Tests
Tests for [API Quickstart samples](https://auth0.com/docs/quickstart/backend).
## Getting Started
Clone the repo and install the dependencies.
```bash
npm install
```
## Configure Auth0's API and Clients
[Create an API](https://manage.auth0.com/#/apis), and set the scopes of `read:messages` and `write:messages`.
[Create four clients](https://manage.auth0.com/#/clients) of type **Non Interactive Clients**.
Configure the following grant between clients and API:
* A client grant without any scope.
* A client grant with a scope of `read:messages`.
* A client grant with a scope of `write:messages`.
* A client grant with the scopes of `read:messages` and `write:messages`.
## Set up the `.env` file
Rename `.env.example` to `.env` and replace the values for variables:
* `AUTH0_DOMAIN` with your Auth0's domain.
* `AUTH0_AUDIENCE` with your api identifier configured above.
* `AUTH0_CLIENT_ID_1` and `AUTH0_CLIENT_SECRET_1` with **client id** and **client secret** from the client without any scope granted.
* `AUTH0_CLIENT_ID_2` and `AUTH0_CLIENT_SECRET_2` with **client id** and **client secret** from the client with a scope of `read:messages` granted.
* `AUTH0_CLIENT_ID_3` and `AUTH0_CLIENT_SECRET_3` with **client id** and **client secret** from the client with a scope of `write:messages` granted.
* `AUTH0_CLIENT_ID_4` and `AUTH0_CLIENT_SECRET_4` with **client id** and **client secret** from the client with the scopes of `read:messages` and `write:messages` granted.
## Running the tests
In order to run the tests execute:
```bash
npm test
```
**Note:** Returned error codes from the [Symfony](https://auth0.com/docs/quickstart/backend/symfony) API are different from the standard. For those cases execute:
```bash
quickstart="symfony" npm test
```