jhk753 / gmail-ruby-api

Ruby interface for Gmail API
Other
26 stars 20 forks source link

Serious bug when you have multiple gmail clients #21

Open 3mammoth opened 9 years ago

3mammoth commented 9 years ago

To replicate:


Gmail.client_secrets = CLIENT_SECRET
Gmail.gmail_refresh_token = TOKEN
email = Gmail.mailbox_email # Will give you an inbox

Gmail.gmail_refresh_token = ANOTHER_TOKEN
email2 = Gmail.mailbox_email # Will give you the same email
email2 == email```

This can be serious when you are delivering messages for multiple clients.
jhk753 commented 9 years ago

@Carpela You seemed to be more active than I'm those days, and I think you tried this when you asked if we can close an open connection....

Did you have the same problem ?

Thanks

Carpela commented 9 years ago

I fixed it in some code that I put oin the pull request for Service accounts. I don't use the standard oauth but I suspect that the fix would be similar.

johnnyshields commented 6 years ago

The code needs to be refactored so that there is a Gmail::Client which has credentials, rather than using class-level variables.

Carpela commented 6 years ago

I'd agree with that last comment. Bit of a pig to do though. All PRs gratefully accepted.... Also, it'd obviously be a seriously breaking change if it were done.