Skip to content

Commit 06e29d0

Browse files
committed
New: Added API to authorize the user in OAuth2 services
1 parent 3137d64 commit 06e29d0

File tree

7 files changed

+673
-15
lines changed

7 files changed

+673
-15
lines changed

.jshintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"Request": true,
2323
"Headers": true,
2424
"Response": true,
25-
"ArcBehaviors": true
25+
"ArcBehaviors": true,
26+
"URLSearchParams": true
2627
}
2728
}

app.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
</head>
5151
<body>
5252
<arc-electron></arc-electron>
53-
5453
<link rel="import" href="src/arc-electron.html">
5554
</body>
5655
</html>

main.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const dialog = require('electron').dialog;
55
const {ArcWindowsManager} = require('./scripts/windows-manager');
66
const {UpdateStatus} = require('./scripts/update-status');
77
const {ArcMainMenu} = require('./scripts/main-menu');
8+
const {ArcIdentity} = require('./scripts/oauth2');
89

910
class Arc {
1011
constructor() {
@@ -114,3 +115,13 @@ ipc.on('new-window', function() {
114115
ipc.on('toggle-devtools', (event) => {
115116
event.sender.webContents.toggleDevTools();
116117
});
118+
119+
ipc.on('oauth-2-get-token', (event, options) => {
120+
ArcIdentity.getAuthToken(options)
121+
.then(token => {
122+
event.sender.send('oauth-2-token-ready', token);
123+
})
124+
.catch(cause => {
125+
event.sender.send('oauth-2-token-error', cause);
126+
});
127+
});

package-lock.json

Lines changed: 31 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"files": [
4242
"app.html",
4343
"main.js",
44+
"package.json",
4445
"assets/",
4546
"bower_components/",
4647
"menus/",
@@ -119,5 +120,16 @@
119120
"repo": "arc-electron"
120121
}
121122
]
123+
},
124+
125+
"oauth2": {
126+
"client_id": "1076318174169-u4a5d3j2v0tbie1jnjgsluqk1ti7ged3.apps.googleusercontent.com",
127+
"auth_uri": "https://accounts.google.com/o/oauth2/v2/auth",
128+
"redirect_uri": "https://auth.advancedrestclient.com/oauth2",
129+
"scopes": [
130+
"https://www.googleapis.com/auth/drive.file",
131+
"https://www.googleapis.com/auth/drive.install",
132+
"https://www.googleapis.com/auth/drive.metadata.readonly"
133+
]
122134
}
123135
}

0 commit comments

Comments
 (0)