{"id":20534815,"url":"https://github.com/nagilum/oauth2-nodejs","last_synced_at":"2025-10-07T03:38:21.931Z","repository":{"id":150121627,"uuid":"60431715","full_name":"nagilum/oauth2-nodejs","owner":"nagilum","description":"A simple nodejs OAuth2 auth-code wrapper library.","archived":false,"fork":false,"pushed_at":"2016-06-06T10:41:12.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-11T11:45:16.468Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/nagilum.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","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":"2016-06-04T21:51:25.000Z","updated_at":"2016-06-04T21:52:15.000Z","dependencies_parsed_at":"2023-04-23T16:17:18.425Z","dependency_job_id":null,"html_url":"https://github.com/nagilum/oauth2-nodejs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nagilum/oauth2-nodejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nagilum%2Foauth2-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nagilum%2Foauth2-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nagilum%2Foauth2-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nagilum%2Foauth2-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nagilum","download_url":"https://codeload.github.com/nagilum/oauth2-nodejs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nagilum%2Foauth2-nodejs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278717080,"owners_count":26033535,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-16T00:28:13.404Z","updated_at":"2025-10-07T03:38:21.893Z","avatar_url":"https://github.com/nagilum.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"A simple nodejs OAuth2 auth-code wrapper library.\r\n\r\n## How to Create the Redirect\r\n\r\n```js\r\nvar oauth2 = require('oauth2-nodejs'),\r\n\tsystemRedirectUri = oauth2.CreateRedirect(\r\n\t\t{\r\n\t\t\tclientId: 'my-client-id',\r\n\t\t\tscope: 'email',\r\n\t\t\tauthUri: 'https://graph.facebook.com/oauth/authorize'\r\n\t\t},\r\n\t\t'https://awesome-domain.com/my-awesome-oauth-callback',\r\n\t\t'en');\r\n```\r\n\r\nThis will give you a URI you can just forward the user too. They will sign in and give the app access, which will redirect back to: `https://awesome-domain.com/my-awesome-oauth-callback?code=XXX`\r\n\r\n## How to Authenticate by Code\r\n\r\n```js\r\nvar oauth2 = require('oauth2-nodejs');\r\n\r\noauth2.AuthenticateByCode(\r\n\t{\r\n\t\tclientId: 'my-client-id',\r\n\t\tclientSecret: 'my-client-secret',\r\n\t\tscope: 'email',\r\n\t\taccessTokenUri: 'https://graph.facebook.com/oauth/access_token'\r\n\t},\r\n\t'https://awesome-domain.com/my-awesome-oauth-callback',\r\n\t'code-from-provider',\r\n\tfunction (res) {\r\n\t\t// res.accessToken\r\n\t\t// res.expires\r\n\t}\r\n);\r\n```\r\n\r\nThe library will make a web request to the provider with the auth code given and, hopefully, return with a valid access token. You are now authorized with the given provider.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnagilum%2Foauth2-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnagilum%2Foauth2-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnagilum%2Foauth2-nodejs/lists"}