{"id":21932362,"url":"https://github.com/reneweb/oauth2orize_resource_owner_password_example","last_synced_at":"2026-02-27T22:12:36.532Z","repository":{"id":17074081,"uuid":"19839028","full_name":"reneweb/oauth2orize_resource_owner_password_example","owner":"reneweb","description":"This is an example of the oAuth resource owner password flow using oauth2orize, express 4 and mongoDB.","archived":false,"fork":false,"pushed_at":"2016-07-23T19:30:25.000Z","size":14,"stargazers_count":31,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-19T20:49:55.736Z","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":null,"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-15T23:55:03.000Z","updated_at":"2019-01-23T15:30:53.000Z","dependencies_parsed_at":"2022-07-26T12:17:38.464Z","dependency_job_id":null,"html_url":"https://github.com/reneweb/oauth2orize_resource_owner_password_example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/reneweb/oauth2orize_resource_owner_password_example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reneweb%2Foauth2orize_resource_owner_password_example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reneweb%2Foauth2orize_resource_owner_password_example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reneweb%2Foauth2orize_resource_owner_password_example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reneweb%2Foauth2orize_resource_owner_password_example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reneweb","download_url":"https://codeload.github.com/reneweb/oauth2orize_resource_owner_password_example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reneweb%2Foauth2orize_resource_owner_password_example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29917230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"ssl_error","status_checked_at":"2026-02-27T19:37:41.463Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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:24.690Z","updated_at":"2026-02-27T22:12:36.514Z","avatar_url":"https://github.com/reneweb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"oauth2orize_resource_owner_password_example\n===========================================\n\nThis is an example of the oAuth resource owner password flow using oauth2orize, express 4 and mongoDB.\n\n##### Installation\n\n```\ngit clone https://github.com/reneweb/oauth2orize_resource_owner_password_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 - Create a client\n\nFirst of all you need to create a client in the clients collection, for example, with the mongo shell. The client should have a clientId, a clientSecret and it should be a trustedClient.\nFor example:\n{\"clientId\" : \"test\", \"clientSecret\" : \"secret\", \"trustedClient\" : true}\n\n###### 1 - Register a user\n\n```\ncurl -v -H \"Content-Type: application/json\" -X POST \u003cIP\u003e:\u003cPORT\u003e/users -d '{\"username\": \"\u003cusername\u003e\", \"password\": \"\u003cpassword\u003e\"}'\n```\n\n###### 2 - Get an 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 '{\"username\": \"\u003cusername\u003e\", \"password\": \"\u003cpassword\u003e\", \"grant_type\": \"password\"}'\n```\n\n###### 3 - 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###### 4 - Get a new access token using the refresh token\n\n```\ncurl -X POST \u003cIP\u003e:\u003cPORT\u003e/oauth/token -u \u003cclientId\u003e:\u003cclientSecret\u003e -v -H \"Content-Type: application/json\" -d '{\"grant_type\": \"refresh_token\", \"refresh_token\": \"\u003crefreshToken\u003e\"}'\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freneweb%2Foauth2orize_resource_owner_password_example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freneweb%2Foauth2orize_resource_owner_password_example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freneweb%2Foauth2orize_resource_owner_password_example/lists"}