silexlabs / cloud-explorer

*this version is deprecated, see CloudExplorer2* File manager for your users cloud services such as dropbox, google drive and FTP
http://cloud-explorer.org
52 stars 23 forks source link

No login with GitHub connector #54

Closed JbIPS closed 8 years ago

JbIPS commented 8 years ago

Hello @zabojad, I'm trying to add a new GitHub connector but I'm facing an issue after login: the iframe doesn't reload to show the files. If I close the frame and reopen it, my files show up and everything's fine.

@lexoyo targeted the issue here but I don't know why the parameter is undefined here. Do you have any leads? Thanks.

zabojad commented 8 years ago

Hey @JbIPS ! I have no idea about that... Can you post some jsfliddle link or equivalent so that I see better about what you are talking about ?

JbIPS commented 8 years ago

I'd like to, but I don't think I can use them with CE and Unifile, or can you tell me how? On the other hand, you can reproduce it by using the head of master on Unifile but I understand this can be more complicated for you ^^

JbIPS commented 8 years ago

Actually, maybe I can make it a bit clearer now. Here is what happen:

And checked a bit how the Dropbox connector is doing and it's almost the same workflow but the pop-up is not the same. Dropbox is calling oauth-cb.html which is calling the same function but with window.location.search as a parameter, thus refreshing the window.

I'm not very clear on why it's taking a different path so any clue to unblur this will be welcomed :)

zabojad commented 8 years ago

Just re-read the code and Dropbox calls oauth-cb.html because we give it the instruction to do so when opening the authorization popup.

So now, why Github isn't doing the same? Is it the same version of oAuth? Does it support to be given a callback url? If yes, what is the way to pass it the cb page url?

JbIPS commented 8 years ago

The callback URL on GitHub has to be given when registering the application. Your saying that giving it server/oauth-cb.html as URL will fix the problem?

zabojad commented 8 years ago

What I'm saying is that the callback url has a point with the version of oauth Dropbox uses. It's the way CE knows if the use of the Dropbox service for CE has been approved by the user. I guess it should work the same way with Github's oauth... What happens when you try to set server/oauth-cb.html as the cb url for your Github app ?

JbIPS commented 8 years ago

GitHub is expecting an endpoint where it can send me a token for the session. So if I use oauth-cb.html as callback I get

Cannot GET /libs/cloud-explorer/oauth_cb.html?code=XXXXXXXX

Is there a way to 'simulate' what this popup is doing?