{"id":21932349,"url":"https://github.com/reneweb/oauth2orize_authorization_grant_example","last_synced_at":"2025-04-19T19:28:34.702Z","repository":{"id":17119426,"uuid":"19885551","full_name":"reneweb/oauth2orize_authorization_grant_example","owner":"reneweb","description":"This is an example of the oAuth authorization grant flow using oauth2orize, express 4 and mongoDB.","archived":false,"fork":false,"pushed_at":"2015-04-22T13:03:43.000Z","size":290,"stargazers_count":24,"open_issues_count":1,"forks_count":14,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T12:11:48.092Z","etag":null,"topics":["expressjs","javascript","mongodb","oauth2orize"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"xavieryao/Happy-Birthday","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reneweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-17T11:59:43.000Z","updated_at":"2021-11-10T22:40:31.000Z","dependencies_parsed_at":"2022-08-24T10:40:21.623Z","dependency_job_id":null,"html_url":"https://github.com/reneweb/oauth2orize_authorization_grant_example","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/reneweb%2Foauth2orize_authorization_grant_example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reneweb%2Foauth2orize_authorization_grant_example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reneweb%2Foauth2orize_authorization_grant_example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reneweb%2Foauth2orize_authorization_grant_example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reneweb","download_url":"https://codeload.github.com/reneweb/oauth2orize_authorization_grant_example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249779231,"owners_count":21324382,"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":["expressjs","javascript","mongodb","oauth2orize"],"created_at":"2024-11-28T23:18:21.043Z","updated_at":"2025-04-19T19:28:34.665Z","avatar_url":"https://github.com/reneweb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"oauth2orize_authorization_grant_example\n=======================================\n\nThis is an example of the oAuth authorization grant flow using oauth2orize, express 4 and mongoDB.\n\n##### Installation\n\n```\ngit clone https://github.com/reneweb/oauth2orize_authorization_grant_example.git\nnpm install\nnode app.js\n```\nNote: You may need to change the database configuration in the db.js file, if mongoDB doesn't run using the default port or is not running on localhost.\n\n##### Usage (with cURL)\n\n###### 0 - Register a client\n\nNavigate to /client/registration. Register a new client.\n\n###### 1 - Register a user\n\nNavigate to /registration. Register a new user.\n\n###### 2 - Get authorization token\n\nNavigate to /oauth/authorization?clientId=\u0026lt;clientId\u0026gt;\u0026redirectUri=\u0026lt;redirectUri\u0026gt;\u0026responseType=code. Login with username and password. Then allow the client to access your account.\nIf everything works the authorization code is returned.\n\n###### 3 - Exchange the authorization code for a access token\n\n```\ncurl  -v  -H \"Content-Type: application/json\" -X POST \u003cIP\u003e:\u003cPORT\u003e/oauth/token -u \u003cclientId\u003e:\u003cclientSecret\u003e -d '{\"code\": \"\u003cauthorization_code\u003e\", \"grant_type\": \"authorization_code\"}'\n```\n\n###### 4 - Access a restricted resource using the access token\n\n```\ncurl -X GET \u003cIP\u003e:\u003cPORT\u003e/restricted -v -H \"Authorization: Bearer \u003caccessToken\u003e\"\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freneweb%2Foauth2orize_authorization_grant_example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freneweb%2Foauth2orize_authorization_grant_example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freneweb%2Foauth2orize_authorization_grant_example/lists"}