Skip to content

In sandbox mode, window.opener doesn't work when children are from different domain #8100

Closed

Description

@davidrevmakx
  • Electron version: 1.4.10
  • Operating system: Darwin x64

Expected behavior

When a popup pointed to a different domain from the parent is opened. window.opener should not be null. It is required for many OAuth authentication where the parent and the child (popup) is from different domains.

Actual behavior

When a popup is pointed towards the same domain window.opener is present but when its pointed towards a different domain window.opener is null

How to reproduce

main.js
app.on('ready', () => { console.log("ready"); const win = new BrowserWindow({webPreferences: { sandbox: true }}) win.loadURL('http://localhost:8888/index.html'); })

index.html
<a href="javascript:window.open('https://app.asana.com')">Click here</a>

window.opener is null at app.asana.com because the domain is different from the parent

Activity

  1. changed the title [-]window.opener doesn't work when children are from different domain[/-] [+]In sandbox mode, window.opener doesn't work when children are from different domain[/+] on Nov 30, 2016
  2. self-assigned this
    on Nov 30, 2016
  3. sivaram636 commented on Jan 24, 2017

    @sivaram636

    Any updates on this?

  4. neurolag commented on Feb 22, 2017

    @neurolag

    Same issue occured for me as I tried to connect to Deezer using their JavaScript-SDK.

    Is there any way I can work around it?
    Will you guys have some time left for having a look at it in the near future?
    That'd be nice 😄

    Thanks in advance

  5. TheMSB commented on Mar 9, 2017

    @TheMSB

    Having a similar issues when trying authentication with Spotify, is there a flag or workaround we can use to still enable oauth popups?

  6. quanglam2807 commented on Mar 15, 2017

    @quanglam2807
    Contributor

    Same question with @TheMSB. quanglam2807/appifier#39: it affects Spotify, Feedly and a lot of web sites.

  7. alexk111 commented on Apr 10, 2017

    @alexk111

    +1. Getting issue reports from users trying to auth with Google account on many different web apps.

  8. Thomas101 commented on May 17, 2017

    @Thomas101
    Contributor

    We're also seeing the same behaviour in 1.7.1 when using the nativeWindowOpen option as described in the electron docs here

  9. eyarz commented on May 17, 2017

    @eyarz
  10. tarruda commented on May 17, 2017

    @tarruda
    Contributor

    @eyarz thanks, I will try to have a look this week

  11. shimont commented on May 23, 2017

    @shimont

    Looking forward to seeing this bug fixed :)

  12. Tahini-123 commented on May 29, 2017

    @Tahini-123

    Any news? :)

  13. Amzul commented on Jun 14, 2017

    @Amzul

    Also waiting here, :)

  14. 11 remaining items

  15. ryanflowers commented on Jul 25, 2018

    @ryanflowers

    Hello, just checking in on this. I assume that there is no traction here as no one is updating the thread. @MarshallOfSound any insight as to whether anyone is actively looking into this? This is pretty limiting considering it blocks our auth flows. Any kind of status or work around info would be super helpful! Thank you in advance :)

    Update: Just noticed @tarruda seems to be the assignee on this one so directing the questions his way. Thank again

  16. BenjaminDobler commented on Aug 1, 2018

    @BenjaminDobler

    I also have this issue with the new Apple MusicKitJS API. Authentication fails because window.opener is null. In my case i have a webview in my app which loads a page which includes MusicKitJS stuff. From there the apple music authentication is happening but fails at the last step because of window.opener = null. This prevents so maybe nice electron use cases. I hope this gets some traction.
    If you need anything from me to reproduce the issue let me know.

  17. alexeykuzmin commented on Aug 13, 2018

    @alexeykuzmin
    Contributor

    @tarruda Are you actually working on this?

  18. tarruda commented on Aug 14, 2018

    @tarruda
    Contributor

    @alexeykuzmin I haven't looked into it yet.

  19. alexeykuzmin commented on Nov 20, 2018

    @alexeykuzmin
    Contributor

    The fix it going to be reverted. Reopen.

  20. pushkin- commented on Feb 14, 2019

    @pushkin-

    @alexeykuzmin Why was this issue closed after the fix was reverted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions