make install
docker-compose upNow when you open docker-compose.yml you can see public port, for node application its 9100.
You can test it via http://localhost:9100/status
Install modules from docker
docker-compose run --rm app npm i npm install --save @hapi/joiTo run test you need have running redis container (docker-compose up).
make testCreate Simple OAuth server to provide authorize and token methods.
- register client (
POST /clients/:idthis method is only for internal usage to manage available clients) - then get
codevia authorize method (GET /oauth/authorize) - with this
codeyou should be able calltokenmethod (GET /oauth/token) and get access token. whencodewas not created by authorize method, returns error. - with access token you should be able access to protected section
GET /api/test
Make some usage-tests in jest as example how it works.
There is no need to make OAuth specification compatible server rather show
- how you can deal with async/await
- how you can write tests
They are used some "recommended" libs you can use...
koa- routingjoi- validationjest- testingioredis- redis clientaxios- request clientnode-injectable- dependency builder via comment hints
GL & HF
NOTE: they are some libs like auth-server, koa-oauth-server and others but not recommended to use, they have issues or no longer maintained.