0 votes

I'm trying to access a Gmail account with OAuth. Following the example of
- I use nuget to download the Google.Apis.Auth package
- Register the application
- I put the imports namespaces

Imports Google.Apis.Auth.OAuth2
Imports Google.Apis.Auth.OAuth2.Flows
Imports Google.Apis.Auth.OAuth2.Requests
Imports Google.Apis.Auth.OAuth2.Responses

Imports Limilabs.Client.Authentication.Google

Imports Limilabs.Client.IMAP

Below I put:

Dim clientID As String = "XXX.apps.googleusercontent.com"
Dim clientSecret As String = "IxBs0g5sdaSDUz4Ea7Ix-Ua"

Dim clientSecrets = New ClientSecrets With { _
     .ClientId = clientID, _
     .ClientSecret = clientSecret _

Dim credential = New GoogleAuthorizationCodeFlow( _
     New GoogleAuthorizationCodeFlow.Initializer With { _
         .ClientSecrets = clientSecrets, _
         .Scopes = { _
             GoogleScope.ImapAndSmtp.Name, _

But the word GoogleScope in the last 2 lines tells me that it is not declared, what am I missing?

by (210 points)

1 Answer

+1 vote

GoogleScope class is declared in Limilabs.Client.Authentication.Google namespace.

You need to import it.

by (298k points)

I already have that namespace imported, and that class does not exist. My version of mail.dll is somewhat old, it is 3.0.12102.1426, is this the problem?

This is very old version.

Please update to the latest one: