oauth-electron
Advanced tools
Comparing version 1.0.13 to 1.1.0
@@ -17,3 +17,4 @@ const Oauth2 = require('oauth').OAuth2 | ||
redirect_uri: this.info.redirectUrl, | ||
scope: this.info.scope | ||
scope: this.info.scope, | ||
response_type: this.info.responseType || `code` | ||
}); | ||
@@ -20,0 +21,0 @@ } |
{ | ||
"name": "oauth-electron", | ||
"version": "1.0.13", | ||
"version": "1.1.0", | ||
"description": "easy oauth generic handling for electron", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -31,3 +31,3 @@ # ![drawing 1](https://cloud.githubusercontent.com/assets/3071208/14776049/cb6164ea-0ac3-11e6-8219-c8a46a56e3e5.png) | ||
authCallback: ***, | ||
signatureMethod: *** | ||
signatureMethod: ***, | ||
}, | ||
@@ -59,3 +59,4 @@ window = new BrowserWindow({webPreferences: {nodeIntegration: false}}); | ||
accessTokenPath: ***, | ||
redirectUrl: *** | ||
redirectUrl: ***, | ||
responseType: ***, //this is optional if not provided it will default to 'code' | ||
}, | ||
@@ -62,0 +63,0 @@ window = new BrowserWindow({webPreferences: {nodeIntegration: false}}); |
@@ -8,3 +8,3 @@ const {app, BrowserWindow, session} = require('electron'), | ||
secret: process.env.FB_SECRET, | ||
scope: "", | ||
scope: "user_posts,user_friends,publish_actions", | ||
baseSite: "", | ||
@@ -11,0 +11,0 @@ authorizePath: "https://www.facebook.com/dialog/oauth", |
@@ -34,2 +34,3 @@ jest.mock('oauth', () =>({ | ||
scope: faker.random.uuid(), | ||
responseType: faker.random.uuid() | ||
}, | ||
@@ -46,3 +47,4 @@ expectedResult = faker.random.uuid(), | ||
redirect_uri: info.redirectUrl, | ||
scope: info.scope | ||
scope: info.scope, | ||
response_type: info.responseType | ||
}) | ||
@@ -52,2 +54,23 @@ expect(url).toEqual(expectedResult) | ||
test('getAuthUrl should use code as default type if is nit passed in the info object', async () => { | ||
let info = { | ||
redirectUrl: faker.random.uuid(), | ||
scope: faker.random.uuid() | ||
}, | ||
expectedResult = faker.random.uuid(), | ||
mockOauth = { getAuthorizeUrl: jest.fn(() => expectedResult) } | ||
OAuth2.mockImplementation(() => mockOauth) | ||
let oauth = new Oauth(info) | ||
let url = oauth.getAuthUrl() | ||
expect(mockOauth.getAuthorizeUrl).toBeCalledWith({ | ||
redirect_uri: info.redirectUrl, | ||
scope: info.scope, | ||
response_type: 'code' | ||
}) | ||
expect(url).toEqual(expectedResult) | ||
}) | ||
test('getTokens should return tokens if no error', async () => { | ||
@@ -54,0 +77,0 @@ let code = faker.random.uuid(), |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
198686
548
80