I just had this issue after upgrading from fedora 24 to 25. the only difference i know of is that now i am using a Wayland session instead of X? this trick worked, but i wonder if it is a wayland related issue.
Yes, this completely has to do with Wayland, which is now the default graphical server in Fedora 25.
Wayland, by design, does not let another user (root in our case) access what our user is doing in their session on the graphical server. So when root tries to open its window in another user's (ie: our user's) graphical session, Wayland (rightly) denies it.
The fix suggested,
allows any and all users to access the current users' graphical session.
If you find this a bit much, you can allow only root to access your current session, with the following:
Once you've finished using the app you want as root, you can remove root from the list of allowed users with:
Hope this helps. At the end of the day, a better solution (using the suggestions in this bug: Bug 1274451 – sudo with graphical apps doesn't work on wayland) should probably be used, as this is really just a workaround (and end-users shouldn't have to be doing this).