Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

social auth without popup or tab #219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/oauth/oauth1.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class OAuth {
* @return {Promise}
*/
init(userData) {
this.oauthPopup = new OAuthPopup('about:blank', this.providerConfig.name, this.providerConfig.popupOptions)
this.oauthPopup = new OAuthPopup('about:blank', this.providerConfig.name, this.providerConfig.display, this.providerConfig.popupOptions)

if (!$window['cordova']) {
this.oauthPopup.open(this.providerConfig.redirectUri, true)
Expand Down
2 changes: 1 addition & 1 deletion src/oauth/oauth2.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class OAuth2 {

let url = [this.providerConfig.authorizationEndpoint, this._stringifyRequestParams()].join('?')

this.oauthPopup = new OAuthPopup(url, this.providerConfig.name, this.providerConfig.popupOptions)
this.oauthPopup = new OAuthPopup(url, this.providerConfig.name, this.providerConfig.display, this.providerConfig.popupOptions)

return new Promise((resolve, reject) => {
this.oauthPopup.open(this.providerConfig.redirectUri).then((response) => {
Expand Down
13 changes: 9 additions & 4 deletions src/oauth/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,23 @@ import { objectExtend, parseQueryString, getFullUrlPath, isUndefined } from '../
* and adjusted to fit vue-authenticate library
*/
export default class OAuthPopup {
constructor(url, name, popupOptions) {
constructor(url, name, display, popupOptions) {
this.popup = null
this.url = url
this.name = name
this.popupOptions = popupOptions
this.display = display
}

open(redirectUri, skipPooling) {
try {
this.popup = $window.open(this.url, this.name, this._stringifyOptions())
if (this.popup && this.popup.focus) {
this.popup.focus()
if (this.display == 'page') {
this.popup = $window.open(this.url, '_self', this._stringifyOptions())
} else {
this.popup = $window.open(this.url, this.name, this._stringifyOptions())
if (this.popup && this.popup.focus) {
this.popup.focus()
}
}

if (skipPooling) {
Expand Down