File tree 1 file changed +17
-6
lines changed
1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -1107,11 +1107,12 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1107
1107
public initImplicitFlowInPopup ( options ?: {
1108
1108
height ?: number ;
1109
1109
width ?: number ;
1110
+ windowRef ?: Window
1110
1111
} ) {
1111
1112
return this . initLoginFlowInPopup ( options ) ;
1112
1113
}
1113
1114
1114
- public initLoginFlowInPopup ( options ?: { height ?: number ; width ?: number } ) : Promise < boolean > {
1115
+ public initLoginFlowInPopup ( options ?: { height ?: number ; width ?: number ; windowRef ?: Window } ) {
1115
1116
options = options || { } ;
1116
1117
return this . createLoginUrl (
1117
1118
null ,
@@ -1127,11 +1128,21 @@ export class OAuthService extends AuthConfig implements OnDestroy {
1127
1128
* Error handling section
1128
1129
*/
1129
1130
const checkForPopupClosedInterval = 500 ;
1130
- let windowRef = window . open (
1131
- url ,
1132
- '_blank' ,
1133
- this . calculatePopupFeatures ( options )
1134
- ) ;
1131
+
1132
+ let windowRef = null ;
1133
+ // If we got no window reference we open a window
1134
+ // else we are using the window already opened
1135
+ if ( ! options . windowRef ) {
1136
+ windowRef = window . open (
1137
+ url ,
1138
+ '_blank' ,
1139
+ this . calculatePopupFeatures ( options )
1140
+ ) ;
1141
+ } else if ( options . windowRef && ! options . windowRef . closed ) {
1142
+ windowRef = options . windowRef ;
1143
+ windowRef . location . href = url ;
1144
+ }
1145
+
1135
1146
let checkForPopupClosedTimer : any ;
1136
1147
1137
1148
const tryLogin = ( hash : string ) => {
You can’t perform that action at this time.
0 commit comments