A simple client and server setup to showcase an issue with apollo dev tools.
This can all be done with a free auth0 account. Once you have an account, there are two things you'll need to create...
This is where you get the domain and client ID values needed in the .env files
- Go to the "Applications" tab in auth0 and click "Create Application"
- Give your application a name (can be anything you want)
- For the type, select "Single Page Web Application" then click create
- Go to the "Settings" section of your application
- Under the "Allowed Callback URLs", "Allowed Logout URLs", and "Allowed Web Origins" fields, put
http://localhost:3000
(the client url) - Click "Save Changes" at the bottom of the "Settings" section to save these changes
This is where you get the audience value needed in the .env files
- Go to the "APIs" tab in auth0 and click "Create API"
- Give your API a name (can be anything you want) and an identifier (NOTE: identifier is in the shape of a url but does not need to be real)
- Click create to create the API
A simple apollo server with two possible queries:
public
- returns an array of public Itemsprotected
- returns an array of protected Items
An item has the following fields: id, name, type
To run the server...
- Navigate to the
server
directory in this repo - Create a
.env
file at the same level as.env.sample
and fill in the necessary info - Install dependencies
yarn install
- Run the server
yarn start
A basic CRA app. Has two buttons, one to trigger the public query and one for the protected query. Both queries are run when the client loads, but may be rerun at any point.
To run the client...
- Navigate to the
client
directory in this repo - Create a
.env
file at the same level as.env.sample
and fill in the necessary info - Install dependencies
yarn install
- Run the client
yarn start