{"id":19110716,"url":"https://github.com/musobarlab/nodejs-oauth2-jwt","last_synced_at":"2025-04-30T20:47:12.327Z","repository":{"id":107266852,"uuid":"82149588","full_name":"musobarlab/nodejs-oauth2-jwt","owner":"musobarlab","description":"oauth2 server example with Node Js","archived":false,"fork":false,"pushed_at":"2019-11-06T17:05:14.000Z","size":27,"stargazers_count":9,"open_issues_count":0,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T08:33:55.758Z","etag":null,"topics":["docker","docker-image","expressjs","jsonwebtoken","jwt-token","nodejs","oauth2"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/musobarlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-16T06:55:18.000Z","updated_at":"2024-03-09T06:15:23.000Z","dependencies_parsed_at":"2023-05-26T15:15:54.601Z","dependency_job_id":null,"html_url":"https://github.com/musobarlab/nodejs-oauth2-jwt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/musobarlab%2Fnodejs-oauth2-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/musobarlab%2Fnodejs-oauth2-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/musobarlab%2Fnodejs-oauth2-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/musobarlab%2Fnodejs-oauth2-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/musobarlab","download_url":"https://codeload.github.com/musobarlab/nodejs-oauth2-jwt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251780428,"owners_count":21642772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-image","expressjs","jsonwebtoken","jwt-token","nodejs","oauth2"],"created_at":"2024-11-09T04:25:50.668Z","updated_at":"2025-04-30T20:47:12.303Z","avatar_url":"https://github.com/musobarlab.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### The OAuth 2.0 Authorization Framework\n- https://tools.ietf.org/html/rfc6749\n- https://tools.ietf.org/html/rfc6749#page-10\n\n#### Node JS Json Web Token using Passport Js for securing api example\n- express js\n- jsonwebtoken\n- basic-auth\n- RSA, here's an awesome website, http://travistidwell.com/jsencrypt/demo/\n  i use this site to generate RSA key\n\n#### Getting started\n```shell\n- cd /your/root/project\n- npm install\n- npm start\n```\n\n#### Using Docker\n* go to your root project run:\n\n```shell\n$ docker build -t node-oauth2-jwt .\n```\n\n* Check your list images :\n\n```shell\n$ docker images\n```\n\n* Run your image\n\n```shell\n$ docker run -it -p 3000:9000 --name [NEW-NAME-FOR-node-oauth2-jwt] [YOUR-DOCKER-IMAGE]\n```\n\n* OR Remove Previous Container first\n\n```shell\n$ docker rm PREVIOUS-NAME-node-oauth2-jwt\n```\n\n* RUN\n  - first inspect docker's VM IP\n  ```shell\n  $ docker inspect --format '{{ .NetworkSettings.IPAddress }}' [YOUR CONTAINER ID]\n  ```\n\n  - then you can visit eg: http://172.17.0.2:3000/\n\n#### Endpoint\n\n```diff\n- POST\n```\n- localhost:3000/register_client\n  - require body :\n    - username, eg: wuriyanto\n\n```diff\n- POST\n```\n- localhost:3000/token?grant_type=client_credentials\n  - require Authorization Basic:\n    - username, eg: wuriyanto\n    - password, eg: xxxx-xxx-xxx-xxxx\n\n```diff\n- POST\n```\n- localhost:3000/token?grant_type=password\n  - require Authorization Basic:\n    - username, eg: valid_client_id\n    - password, eg: 123456\n  - require body :\n    - username, eg: wuriyanto\n    - password, eg: 12345\n\n```diff\n- POST\n```\n- localhost:3000/token?grant_type=refresh_token\n  - require Authorization Basic:\n    - username, eg: valid_client_id\n    - password, eg: 123456\n  - require body :\n      - refresh_token, eg: 27d0a468-3125-4b58-b505-969c3d18bdd1\n\n```diff\n- GET\n```\n- localhost:3000/profile_test\n    - require authorization header (your username_password access token):\n      - access token, eg: 'Bearer eyJhbGc.iOiJIUzI.1NiIsInR'\n\n```diff\n- GET\n```\n- localhost:3000/client_test\n    - require authorization header (your client access token):\n      - access token, eg: 'Bearer eyJhbGc.iOiJIUzI.1NiIsInR'\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmusobarlab%2Fnodejs-oauth2-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmusobarlab%2Fnodejs-oauth2-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmusobarlab%2Fnodejs-oauth2-jwt/lists"}