google / gmail-oauth2-tools

Tools and sample code for authenticating to Gmail with OAuth2
Apache License 2.0
405 stars 211 forks source link

Make sendgmail work with only gmail.send scope #66

Closed favonia closed 8 months ago

favonia commented 8 months ago

Currently, sendgmail is using net/smtp, which requires the entire OAuth2 scope. This PR reduces the required scope down to only https://www.googleapis.com/auth/gmail.send by using the Gmail API instead.

PS:

junyer commented 8 months ago

Currently, sendgmail is using net/smtp, which requires the entire OAuth2 scope. This PR reduces the required scope down to only https://www.googleapis.com/auth/gmail.send by using the Gmail API instead.

I would love to return to using the Gmail API with a fine-grained OAuth2 scope, but that's unfortunately infeasible as per https://github.com/google/gmail-oauth2-tools/issues/32.

PS: I also replaced the deprecated ioutil.

Thanks. I pushed commit ce39ab7ec3b752c6ef933740a1ae36c23cb1ad6b for this.

PPS: It seems by adding the dependency google.golang.org/api I triggered lots of upgrades. Maybe we should just upgrade all dependencies at once?

Done. I pushed commit 6a7a700ec44b6cfc4434561e3a66c53a070b4a61 for this.