Skip to content

loginWithPopup: Cross-Origin-Opener-Policy policy would block the window.closed call. #1418

@HuaqingGuan

Description

@HuaqingGuan

Checklist

Description

we are using auth0 to incrementally consent google API, after login. So when click a button, we try to call Loginwithpop to finish consent. but after the consent finished, in the console log show the error messages below:
Cross-Origin-Opener-Policy policy would block the window.closed call.

Reproduction

Sample app can repro this bug; by change loginWithRedirect to loginWithPopup

Image

Below are some code snippet from my project
public async incrementalConsentGoogle(): Promise {
const { auth0 } = await Auth0.get();
const user = await auth0.getUser();
return auth0.loginWithPopup({
authorizationParams: {
...AUTH0_GOOGLE_CALENDAR_REQUEST.authorizationParams,
login_hint: user?.email,
connection: this.getConnectionFromTokenType("google"),
},
});
}

await incrementalConsentGoogle(getConsentPopup())
.then(async () => {
setAllowAccess(isChecked);
})
.catch(async (error: Error) => {
});

catch can't catch the error: Cross-Origin-Opener-Policy policy would block the window.closed call.

Additional context

I find some posts with the same issue with me, that both not been addressed.

https://community.auth0.com/t/cross-origin-opener-policy-policy-would-block-the-window-closed-call/129059
https://community.auth0.com/t/winchan-js-150-cross-origin-opener-policy-policy-would-block-the-window-closed-call/110030

auth0-spa-js version

@auth0/[email protected]

Which framework are you using (React, Angular, Vue...)?

React

Framework version

[email protected]

Which browsers have you tested in?

Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis points to a verified bug in the code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions