mondora / asteroid

An alternative client for a Meteor backend
MIT License
734 stars 101 forks source link

loginWith token #51

Open ghjunior opened 9 years ago

ghjunior commented 9 years ago

I think some updates to how Meteor handles oauth might have messed things up for asteroid's Chrome platform loginWith methods. Asteroid.prototype._openOauthPopup expects token info from the tabs hash string but it seems like that hash no longer gets set for non-Cordova Meteor apps.

Might have a play around to see how far I get but thought of raising it up here. Awesome library by the way.

chrispolk commented 9 years ago

Yeah, running into some of the same issues. Any luck?

ghjunior commented 9 years ago

Hey @chrispolk, I think I just ended up copying the oauth package from meteor and tweaking it in my project to play nice with asteroid (so adding it to the hash no matter what).

chrispolk commented 9 years ago

@ghjunior nice, any chance that you forked that? I'm running into issues with never seeing the 'login' event emitted

ghjunior commented 9 years ago

@chrispolk, I added what we did to this gist: https://gist.github.com/ghjunior/c8fe1b96d614126d1fc9#file-end_of_popup_response-html-L13-L18

So basically I took the OAuth package Meteor provides and chucked it into a package folder in my Meteor app. The lines outlined are the main changes (removing the conditional Cordova statement). I had also commented out the window.close further down but can't remember if that was necessary or not.

I'm not working on this particular project anymore but I think that did the trick. Hope it helps!

chrispolk commented 9 years ago

@ghjunior thanks! I had at first tried to stay away from having to modify anything server side and tried to set the chrome extension to pull the config div off the page which actually works properly for github auth if the user has never authorized the github app but can't be pulled quickly enough before the redirect if the user has already authorized the app.

Did you push this as a meteor package or was this all done locally?

ghjunior commented 9 years ago

No worries, I just kept it in a local package dir so that Meteor would use that instead of it's baked in one.

madhan5000 commented 8 years ago

@chrispolk I am curious to see your implementation. I am basically trying to do the same for Google Authentication. I am able to get the Credentials and I am not sure how to continue the Asteroid flow there after. https://gist.github.com/madhan5000/42f924b515f36a01b341#file-getmeteorcredentialhack-js-L24

Thanks for your help.