File tree Expand file tree Collapse file tree 1 file changed +8
-14
lines changed
packages/auth/src/platform_browser Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -90,20 +90,14 @@ export function getAuth(app: FirebaseApp = getApp()): Auth {
90
90
} ) ;
91
91
92
92
const authTokenSyncPath = getExperimentalSetting ( 'authTokenSyncURL' ) ;
93
- if ( authTokenSyncPath ) {
94
- // Reduce the chances of an XSS attack by only allowing secure contexts or the same origin.
95
- const isLocalHost = [ 'localhost' , '127.0.0.1' , '0.0.0.0' ] . includes (
96
- location . hostname
97
- ) ;
98
- if ( isSecureContext || isLocalHost ) {
99
- const authTokenSyncUrl = new URL ( authTokenSyncPath , location . origin ) ;
100
- if ( location . origin === authTokenSyncUrl . origin ) {
101
- const mintCookie = mintCookieFactory ( authTokenSyncUrl . toString ( ) ) ;
102
- beforeAuthStateChanged ( auth , mintCookie , ( ) =>
103
- mintCookie ( auth . currentUser )
104
- ) ;
105
- onIdTokenChanged ( auth , user => mintCookie ( user ) ) ;
106
- }
93
+ if ( authTokenSyncPath && isSecureContext ) {
94
+ const authTokenSyncUrl = new URL ( authTokenSyncPath , location . origin ) ;
95
+ if ( location . origin === authTokenSyncUrl . origin ) {
96
+ const mintCookie = mintCookieFactory ( authTokenSyncUrl . toString ( ) ) ;
97
+ beforeAuthStateChanged ( auth , mintCookie , ( ) =>
98
+ mintCookie ( auth . currentUser )
99
+ ) ;
100
+ onIdTokenChanged ( auth , user => mintCookie ( user ) ) ;
107
101
}
108
102
}
109
103
You can’t perform that action at this time.
0 commit comments