jublo / codebird-js

A Twitter library in JavaScript.
https://www.jublo.net/projects/codebird/js
GNU General Public License v3.0
384 stars 97 forks source link

Authentication in popup but return url to parent window after action #132

Closed MiguelDebruyne closed 6 years ago

MiguelDebruyne commented 7 years ago

When trying to authenticate a request token via oauth_authorize or oauth_authenticate a popup /new tab comes up for the user to confirm or decline. Problem is when the user does an action the app redirects the user back to the site on that same popup/tab. I need it to self close and return the url.

Problem is by creating a new window you lose the window pointer because the window redirects itself to twitter for authentication so trying to get the window.location.url doesn't work anymore because of cross-origin problems.

I could do it via PIN but that just seems like to much hassle for the user.

MiguelDebruyne commented 7 years ago

Yeah, probably my bad. I think the problem was because of the callback url. I was using localhost while I should have been using 127.0.0.1 as I have set in my Twitter app settings.

When Twitter redirects back to my app in the popup window I'm able to grab that window again in JS and close it.

mynetx commented 7 years ago

So your issue is resolved?

goug0702 commented 6 years ago

I met the same problem as you. Could you give me some hint on how to grab the window and close it? @MiguelDebruyne

MiguelDebruyne commented 6 years ago

@jublo Sorry didnt notice this, yes this is resolved.

@goug0702 It's been a while, but this was just plain Javascript window handling as far as I remember.

mynetx commented 6 years ago

@MiguelDebruyne Thank you for getting back to me on this. Much appreciated! :)