Skip to content

Commit

Permalink
Merge dea4e2d into b935d45
Browse files Browse the repository at this point in the history
  • Loading branch information
huangjoyce3 committed Sep 17, 2019
2 parents b935d45 + dea4e2d commit 8be8bcc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 25 deletions.
20 changes: 10 additions & 10 deletions dist/appid.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/appid.umd.min.js

Large diffs are not rendered by default.

12 changes: 2 additions & 10 deletions src/PopupController.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,13 @@ class PopupController {
this.window = w;
};

open() {
const h = 700;
const w = 400;
const left = (screen.width - w) / 2;
const top = (screen.height - h) / 2;
this.popup = this.window.open('', 'popup', `left=${left},top=${top},width=${w},height=${h},resizable,scrollbars=yes,status=1`);
open({authUrl}) {
this.popup = this.window.open(authUrl, '_blank');
if (!this.popup) {
throw new PopupError('Unable to open popup')
}
};

navigate({authUrl}) {
this.popup.location.href = authUrl;
};

close() {
this.popup.close();
}
Expand Down
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ class AppID {
async signinWithPopup() {
const {codeVerifier, nonce, state, authUrl} = this.getAuthParams();

this.popup.open();
this.popup.navigate({authUrl});
this.popup.open({authUrl});
const message = await this.popup.waitForMessage({messageType: 'authorization_response'});
this.popup.close();

Expand Down

0 comments on commit 8be8bcc

Please sign in to comment.