Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store the accessToken expiration #525

Closed
joscha opened this issue Dec 5, 2012 · 9 comments
Closed

Store the accessToken expiration #525

joscha opened this issue Dec 5, 2012 · 9 comments

Comments

@joscha
Copy link

@joscha joscha commented Dec 5, 2012

Use case:

I want to use the accessToken to access a GMail account with it. Therefore I need to know the time when the accessToken expires, hence I need the lifetime (or more specifically now()+liefetime) that comes back with the accessToken to be stored, so I can just use the accessToken if it hasn't expired and only refresh it using the refreshToken if its expired before accessing GMail via IMAP.

Feature request: Store the timestamp of the accessToken expiration (now()+lifetime) within the user record, when updating the accessToken.

Related discussions: #495, #464, #522

@scottburch
Copy link

@scottburch scottburch commented Dec 5, 2012

I'll answer your question from the other thread here. I am using the username/password for imap. I don't need an oauth token for that. I'm using node-imap. Here is the code for the connection.

            var account = Collection('emailAccount').findOne(accountId);
            return new ImapConnection({
                username: account.imapUsername,
                password: account.imapPassword,
                host: account.imapServer,
                port: account.imapSecure ? 993 : 443,
                secure: account.imapSecure
            });

Nothing fancy. I don't know how to access gmail using anything that would require oauth.

@joscha
Copy link
Author

@joscha joscha commented Dec 5, 2012

I see - I don't have the user's password - frankly I don't think any sane user would give out the password to the emails to be stored elsewhere :-) I just add the GMail scope when users sign up to my Meteor app and then use the OAuth data to access GMail.

@scottburch
Copy link

@scottburch scottburch commented Dec 5, 2012

Cool. I'll have to look into how to do that. Thanks.

@joscha
Copy link
Author

@joscha joscha commented Dec 5, 2012

Sure - it works with node-imap and https://github.com/andris9/xoauth2. The additional scope you need to add is https://mail.google.com/. Vote for this feature request, you are going to need the lifetime of the accessToken as much as me soon :-)

@scottburch
Copy link

@scottburch scottburch commented Dec 5, 2012

It's quicker to put in a pull request. Should not be difficult to add.

@avital
Copy link
Contributor

@avital avital commented Dec 5, 2012

I would happily review a pull request implementing this but I don't think the meteor core team is going to work on this for now.

@AVGP
Copy link

@AVGP AVGP commented Dec 16, 2012

@avital Is that what you've been looking for?

@joscha
Copy link
Author

@joscha joscha commented Dec 16, 2012

@AVGP nice work!

@ghost ghost assigned avital Dec 19, 2012
@avital
Copy link
Contributor

@avital avital commented Dec 27, 2012

@AVGP's change has been merged in as 79405a4, with minor modifications at 1e09d4e. It'd be great to get this working for all of the OAuth providers -- #576

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.