Closed bernatfortet closed 9 years ago
Yes, I think you have a similar problem as @foobarbecue in issue #30 .
Take a look at this example, and also make sure to add the mondora:asteroid
package to your meteor server.
If you still have issues, we can schedule a hangout and see if we can solve them. :smiley:
Cheers
I should have mentioned. I went through thtat thread.
this.ddp.on('connected', =>
console.log 'Connected'
this.ddp.subscribe("meteor.loginServiceConfiguration").ready.then =>
this.ddp.loginWithTwitter()
)
this.ddp.on('login', (loggedInUserId) =>
console.log 'Logged, userId:', loggedInUserId
this.userId = loggedInUserId
)
I think I've tried everything I could understand from issue #30 and examples.
I'd love to schedule a hangout. Thanks!
I may have figured it out. :smiley:
First of all, I'm assuming this.ddp
is your asteroid instance. Said that, each time you call loginWithXXX
(in this case Twitter), Asteroid opens the popup and starts the oauth dance. After the dance has finished, Asteroid stores a session token in localStorage
(or, in case of chrome extensions, in chrome.storage.local
). When an instance of Asteroid is created, it automatically attempts to resume a previous session if a token is found in localStorage
. Therefore, after logging in once via twitter, the next time the background tab reloads it'll automatically login, and there is no need to call loginWithTwitter
again.
Hope this clears things up. If not, feel free to schedule a hangout, when I'm not asleep I'm more or less always available. :smile:
Cheers
Hey @pscanf,
Closing issue post-hangout. :-) Reopen if needed.
For future reference:
connectToMeteor: ->
this.ddp = new Asteroid("localhost:3000");
this.ddp.on('connected', =>
console.log 'Connected'
this.ddp.resumeLoginPromise.then( ->
console.log ('user is already logged in')
).fail( ->
this.ddp.subscribe("meteor.loginServiceConfiguration").ready.then =>
this.ddp.loginWithTwitter()
)
)
this.ddp.on('login', (loggedInUserId) =>
console.log 'Logged, userId:', loggedInUserId
this.userId = loggedInUserId
)
Hi!
I've created a Chrome Extension, basically a background page that listens to a browser action (pressing on the extension icon). When that happens it send information about the page to the Meteor Backend.
The problem relies in the fact that everytime I open Chrome the background page logs in with twitter and opens a new tab in the browser.
Is there a way to do the login process in the backround? Or maybe store the credentials?
Am I explaining myself properly?
Thanks!