{"id":17891366,"url":"https://github.com/alvarolorentedev/oauth-electron","last_synced_at":"2025-03-22T20:33:07.262Z","repository":{"id":50445389,"uuid":"56853960","full_name":"alvarolorentedev/oauth-electron","owner":"alvarolorentedev","description":"General OAuth support for electron App. ","archived":false,"fork":false,"pushed_at":"2024-05-17T00:05:01.000Z","size":1448,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-17T01:25:12.936Z","etag":null,"topics":["authentication","authorization","electron","oauth"],"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/alvarolorentedev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":["kanekotic"],"custom":["https://www.paypal.me/kanekotic/"]}},"created_at":"2016-04-22T12:31:34.000Z","updated_at":"2024-05-31T01:41:43.041Z","dependencies_parsed_at":"2022-09-26T20:53:14.887Z","dependency_job_id":"69ebf898-facf-46d7-a4e5-b1e502336c8d","html_url":"https://github.com/alvarolorentedev/oauth-electron","commit_stats":{"total_commits":124,"total_committers":4,"mean_commits":31.0,"dds":"0.30645161290322576","last_synced_commit":"745bfe20717cba303b6586d260a2ff5b0b1e8d06"},"previous_names":["alvarolorentedev/oauth-electron","kanekotic/oauth-electron"],"tags_count":128,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarolorentedev%2Foauth-electron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarolorentedev%2Foauth-electron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarolorentedev%2Foauth-electron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvarolorentedev%2Foauth-electron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alvarolorentedev","download_url":"https://codeload.github.com/alvarolorentedev/oauth-electron/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221839155,"owners_count":16889591,"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":["authentication","authorization","electron","oauth"],"created_at":"2024-10-28T14:16:46.426Z","updated_at":"2024-10-28T14:16:46.987Z","avatar_url":"https://github.com/alvarolorentedev.png","language":"JavaScript","funding_links":["https://github.com/sponsors/kanekotic","https://www.paypal.me/kanekotic/"],"categories":[],"sub_categories":[],"readme":"# ![drawing 1](https://cloud.githubusercontent.com/assets/3071208/14776049/cb6164ea-0ac3-11e6-8219-c8a46a56e3e5.png)\n[![Build Status](https://travis-ci.org/kanekotic/oauth-electron.svg?branch=master)](https://travis-ci.org/kanekotic/oauth-electron)\n[![codecov](https://codecov.io/gh/kanekotic/oauth-electron/branch/master/graph/badge.svg)](https://codecov.io/gh/kanekotic/oauth-electron)\n[![npm](https://img.shields.io/npm/dy/oauth-electron.svg)](https://github.com/kanekotic/oauth-electron)\n[![GitHub license](https://img.shields.io/github/license/kanekotic/oauth-electron.svg)](https://github.com/kanekotic/oauth-electron/blob/master/LICENSE)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/kanekotic/oauth-electron/graphs/commit-activity)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/kanekotic/)\n\nUse OAuth in a simple way inside your electron App.\n\n## Installation\n\nadd it to your electron project using `npm install oauth-electron --save` or `yarn add oauth-electron`\n\n## Usage\n\nrequire `oauth-electron` exports a function that requires a javascript object and an electron window, as seen on the next example:\n\n### Oauth1\n\n```js\nconst login = require(`oauth-electron`)\n\nlet info = {\n    key: ***,\n    secret: ***,\n    accessUrl: ***,\n    authenticateUrl: ***,\n    version: ***,\n    authCallback: ***,\n    signatureMethod: ***,\n},\nwindow = new BrowserWindow({webPreferences: {nodeIntegration: false}});\n\nlogin.oauth1(info, window)\n```\nthe login function will return a Promise with the access token and secret\n\n```\n{\n    token: ***,\n    tokenSecret: ***\n}\n```\n\n### Oauth2\n\n```js\nconst login = require('oauth-electron')\nconst { BrowserWindow, session } = require('electron')\n\nlet info = {\n    key: ***,\n    secret: ***,\n    scope: ***,\n    baseSite: ***,\n    authorizePath: ***,\n    accessTokenPath: ***,\n    redirectUrl: ***,\n    responseType: ***, //this is optional if not provided it will default to 'code'\n},\nwindow = new BrowserWindow({webPreferences: {nodeIntegration: false}});\n\nlogin.oauth2(info, window, session)\n```\n\nthe login function will return a Promise with the access token and secret\n\n```\n{\n    accessToken: ***,\n    refreshToken?: ***,\n    \u003cothers: ***\u003e\n}\n```\n\n## Security\n\nConsider this before you integrate this library in your application:\n- It is a bad practice to hardcode `keys` \u0026 `secrets` in code that is going to be shipped.\n- If you are looking to have your own backend, consider using it for authentication with 3rd party services. [IETF RFC 8252](https://tools.ietf.org/html/rfc8252).\n\n## Migration V1.x to V2.x\n\n- Please refer to the response of the service, as there will probably be extra fields in the response\n- session is required to be passed as events of chromium have changed\n\n## Migration V0.x to V1.x\n\n- there is no more need for the oauth object, info becomes a basic object with the properties stated in the usage step.\n- the return object has a different format.\n\n###### logo: Award,Passport graphics by \u003ca href=\"http://www.freepik.com/\"\u003eFreepik\u003c/a\u003e from \u003ca href=\"http://www.flaticon.com/\"\u003eFlaticon\u003c/a\u003e are licensed under \u003ca href=\"http://creativecommons.org/licenses/by/3.0/\" title=\"Creative Commons BY 3.0\"\u003eCC BY 3.0\u003c/a\u003e. Made with \u003ca href=\"http://logomakr.com\" title=\"Logo Maker\"\u003eLogo Maker\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falvarolorentedev%2Foauth-electron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falvarolorentedev%2Foauth-electron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falvarolorentedev%2Foauth-electron/lists"}