
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
electron-oauth
Advanced tools
A library to handle OAuth2 authentication for your Electron app.
$ npm install --save electron-oauth
const electronOauth = require('electron-oauth');
var config = {
clientId: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET',
authorizationUrl: 'AUTHORIZATION_URL',
tokenUrl: 'TOKEN_URL',
useBasicAuthorizationHeader: false,
redirectUri: 'http://localhost'
};
app.on('ready', () => {
const windowParams = {
alwaysOnTop: true,
autoHideMenuBar: true,
webPreferences: {
nodeIntegration: false
}
}
const options = {
scope: 'SCOPE',
accessType: 'ACCESS_TYPE'
};
const myApiOauth = electronOauth(config, windowParams);
myApiOauth.getAccessToken(options)
.then(token => {
// use your token.access_token
myApiOauth.refreshToken(token.refresh_token)
.then(newToken => {
//use your new token
});
});
});
Type: Object
Type: String
The URL for the authorization request.
Type: String
The URL for the access token request.
Type: String
The OAuth2 client id.
Type: String
The OAuth2 client secret.
Type: bool
If set to true, token requests will be made using a Basic authentication header instead of passing the client id and secret in the body.
Type: String
Sets a custom redirect_uri that can be required by some OAuth2 clients.
Default: urn:ietf:wg:oauth:2.0:oob
Type: Object
An object that will be used to create the BrowserWindow. Details: Electron BrowserWindow documention
Returns a Promise that gets resolved with the retrieved access token object if the authentication succeeds.
Type: String
The optional OAuth2 scopes.
Type: String
The optional OAuth2 access type.
Type: Object
The optional additional parameters to pass to the server in the body of the token request.
Returns a Promise that gets resolved with the authorization code of the OAuth2 authorization request.
Type: String
The optional OAuth2 scope.
Type: String
The optional OAuth2 access type.
Returns a Promise that gets resolved with the refreshed token object.
Type: String
An OAuth2 refresh token.
MIT © [Vishal Isharani]
FAQs
An OAuth2 module for your Electron app.
We found that electron-oauth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.