0 votes

Hi, If I use a google user that has granted only the readonly scope ("https://www.googleapis.com/auth/gmail.readonly") instead of the full access scope --> "https://mail.google.com/". I get an {"[ALERT] Invalid credentials (Failure)"} error, I found that the scope is hardcoded in this property GoogleScope.ImapAndSmtp. Is there any way that I can override the scope that the lib is using?

I only need readonly permission to get user's messages and i don't want to force the user grant to my app higher privileges than the strictly needed to access their messages.

I think it will be better if the developer can configure the scope that is used to hit the google api.

thanks!

by

1 Answer

0 votes
 
Best answer

If I use a google user that has granted only the readonly scope
("https://www.googleapis.com/auth/gmail.readonly") instead of the full
access scope --> "https://mail.google.com/". I get an {"[ALERT]
Invalid credentials (Failure)"} error,

I don't think you can use this scope to access GMail via IMAP. Error you get is raised by Gmail not Mail.dll

You should report this to Google if you believe this scope should be working

I found that the scope is hardcoded in this property GoogleScope.ImapAndSmtp. Is there any way that I can override the scope that the lib is using?

The scope is not hard-coded anywhere. GoogleScope constructor is public and you can use it to create any scope you want:

var scope = new GoogleScope("https://mail.google.com/")

I think it will be better if the developer can configure the scope that is used to hit the google api.

I think so too, that's why it is not hard-coded and you can use any scope you want.

by (297k points)
...