2019-12-17 20:32:14 +01:00
# auth0-mock-server
> This server helps you to simulate auth0 server locally. So, you are able to use the `/tokeninfo` endpoint to verify your token.
## Getting Started
2023-03-10 13:49:33 +01:00
2019-12-17 20:32:14 +01:00
### Prerequisites
2023-03-10 13:49:33 +01:00
- Install [Node.js ](http://nodejs.org )
- on OSX use [homebrew ](http://brew.sh ) `brew install node`
- on Windows use [chocolatey ](https://chocolatey.org/ ) `choco install nodejs`
2019-12-17 20:32:14 +01:00
## Installing
2023-03-10 13:49:33 +01:00
- `fork` this repo
- `clone` your fork
- `npm install` to install all dependencies
2019-12-17 20:32:14 +01:00
## Running the app
2023-03-10 13:49:33 +01:00
2019-12-17 20:32:14 +01:00
After you have installed all dependencies you can now run the app.
Run `npm start` to start a local server.
The port will be displayed to you as `http://0.0.0.0:3333` (or if you prefer IPv6, if you're using `express` server, then it's `http://[::1]:3333/` ).
2023-06-01 12:26:43 +02:00
## Initial users
Adding a JSON file with the following layout will populate the users store when starting:
``` json
{
"email@test.com" : {
"given_name" : "name" ,
"family_name" : "family" ,
"user_id" : "id"
}
}
```
By default `./users.json` will be read but this can be overridden by setting the environment variable `USERS_FILE` .
2019-12-17 20:32:14 +01:00
## API Documentation
### `GET` /token/:username
2023-03-10 13:49:33 +01:00
2019-12-17 20:32:14 +01:00
Returns a token with the given user(username). This token can the be used by your application.
### `POST` /tokeninfo
2023-03-10 13:49:33 +01:00
2019-12-17 20:32:14 +01:00
Returns the data of the token like the username.
**Body **
2023-03-10 13:49:33 +01:00
2019-12-17 20:32:14 +01:00
```
{
"id_token": "your-token-kjasdf6ashasl..."
}
```
## Related Projects
2023-03-10 13:49:33 +01:00
- [express-typescript-boilerplate ](https://github.com/w3tecch/express-typescript-boilerplate ) - Boilerplate for an restful express-apllication written in TypeScript
- [express-graphql-typescript-boilerplate ](https://github.com/w3tecch/express-graphql-typescript-boilerplate ) - A starter kit for building amazing GraphQL API's with TypeScript and express by @w3tecch
2019-12-17 20:32:14 +01:00
## License
2023-03-10 13:49:33 +01:00
[MIT ](/LICENSE )
2019-12-17 20:32:14 +01:00
---
2023-03-10 13:49:33 +01:00
Made with ♥ by Gery Hirschfeld ([@GeryHirschfeld1 ](https://twitter.com/GeryHirschfeld1 ))