Skip to content

Commit 49006d0

Browse files
committed
Make a popup for oAuth dance
1 parent cbd9b57 commit 49006d0

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

dist/scripts/api-console.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2295,6 +2295,14 @@
22952295
return scopes;
22962296
}
22972297

2298+
function popup(location) {
2299+
var w = 640;
2300+
var h = 480;
2301+
var left = (screen.width / 2) - (w / 2);
2302+
var top = (screen.height / 2) - (h / 2);
2303+
return window.open(location, 'Authentication', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
2304+
}
2305+
22982306
Oauth2.prototype.authenticate = function(options, done) {
22992307
var auth = new ClientOAuth2({
23002308
clientId: this.credentials.clientId,
@@ -2321,7 +2329,7 @@
23212329
});
23222330
};
23232331
//// TODO: Find a way to handle 404
2324-
window.open(auth[grantType].getUri());
2332+
popup(auth[grantType].getUri());
23252333
}
23262334

23272335
if (grantType === 'owner') {

src/common/client/auth_strategies/oauth2.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
return scopes;
1919
}
2020

21+
function popup(location) {
22+
var w = 640;
23+
var h = 480;
24+
var left = (screen.width / 2) - (w / 2);
25+
var top = (screen.height / 2) - (h / 2);
26+
return window.open(location, 'Authentication', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
27+
}
28+
2129
Oauth2.prototype.authenticate = function(options, done) {
2230
var auth = new ClientOAuth2({
2331
clientId: this.credentials.clientId,
@@ -44,7 +52,7 @@
4452
});
4553
};
4654
//// TODO: Find a way to handle 404
47-
window.open(auth[grantType].getUri());
55+
popup(auth[grantType].getUri());
4856
}
4957

5058
if (grantType === 'owner') {

0 commit comments

Comments
 (0)