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 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

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 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

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

@joscha
Copy link
Author

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

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

@avital
Copy link
Contributor

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 commented Dec 16, 2012

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

@joscha
Copy link
Author

joscha commented Dec 16, 2012

@AVGP nice work!

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

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

@avital avital closed this as completed Dec 27, 2012
StorytellerCZ pushed a commit that referenced this issue Sep 18, 2021
Update eslint to the latest version 🚀
StorytellerCZ pushed a commit that referenced this issue Oct 1, 2021
Link to http://react-components.com/ displays 'Service Unavailable'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants