I have a client (written in Python) that opens a new browser tab where the user can give OAuth2 permission to my application; they are then redirected to my site, on a Flask route, where I do some database operations, and then want to close the tab.
As a Flask route, though, I need to return something - I've tried to see if there's a special return value to close the tab, but haven't found anything, and redirecting to a different page with JavaScript that tells the tab to close doesn't work (I'm guessing because you need the same script to have opened that tab).
Is there any way to achieve this? The site is simply a front for a RESTful API, so has no real content to show - I'd like to avoid adding a landing page to instruct the user to close the tab themselves.
EDIT: This is not a duplicate, as I am aware I cannot just open a page that closes itself - but the tab I open in the first place is opened from my client, and I am redirected to my own site; the question asks if, with these options as well, it becomes possible to close the tab.