https://github.com/jmjuanes/electron-auth
A dead simple electron library to handle the OAuth authentication for some providers
https://github.com/jmjuanes/electron-auth
electron electron-plugin oauth-client
Last synced: about 1 month ago
JSON representation
A dead simple electron library to handle the OAuth authentication for some providers
- Host: GitHub
- URL: https://github.com/jmjuanes/electron-auth
- Owner: jmjuanes
- License: mit
- Created: 2017-04-07T22:13:51.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-02T21:26:51.000Z (almost 8 years ago)
- Last Synced: 2024-10-12T22:28:21.469Z (8 months ago)
- Topics: electron, electron-plugin, oauth-client
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/electron-auth
- Size: 9.77 KB
- Stars: 13
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# electron-auth
[](https://www.npmjs.com/package/electron-auth)
[](https://www.npmjs.com/package/electron-auth)
[](https://github.com/jmjuanes/electron-auth)> A dead simple electron library to handle the OAuth authentication for some providers
**NOTE**: More authorization providers and documentation are in progress. Interested in contribute? You are welcome :smile:
## Installation
```
npm install --save electron-auth
```## Usage
```javascript
//Import dependencies
var app = require('electron').app;
var auth = require('electron-auth');//Initialize the application
app.on('ready', function()
{
//Initialize the github auth options
var opt = { client_id: 'YOUR_CLIENT_ID', client_secret: 'YOUR_CLIENT_SECRET' };//Handle the github authentication
return auth(auth.providers.github, opt, function(error, token)
{
//Do your magic with the token
//....
});
});
```## API
#### auth(provider, options, callback)
Perform the user authentication for the desired provider. This method accepts the following arguments:
- `provider`: an object with the information about the provider. You can use the built-in providers or use a custom provider.
- `options`: an object with the options.
- `callback`: a function that will be executed when the authentication is done or when there is an error during the process of authentication.## Providers
All the supported providers are stored in `auth.providers.PROVIDER_NAME`. You can also use your own provider.
### GitHub
Read more about the GitHub Authentication: https://developer.github.com/v3/oauth/
## Related
- [electron-ejs](https://github.com/jmjuanes/electron-ejs): Simple Electron plugin for rendering EJS templates.
## License
[MIT LICENSE](./LICENSE) © Josemi Juanes.