我卡在 Google Calendar Api version3 的授权上
我正在尝试构建的是一个将数据库内容提供给 Google 日历的应用程序
我让这个应用程序在 Google Api 版本 2 下完全运行。但是我想使用版本 3 中的一些新功能。
不幸的是,版本 3 向后不兼容
到目前为止,这是我的代码:
Imports DotNetOpenAuth.OAuth2
Imports Google.Apis.Authentication.OAuth2
Imports Google.Apis.Authentication.OAuth2.DotNetOpenAuth
Imports Google.Apis.Calendar.v3
Imports Google.Apis.Calendar.v3.Data
Imports Google.Apis.Util
Public Shared Sub Main(args As String())
Dim provider = New NativeApplicationClient(GoogleAuthenticationServer.Description)
provider.ClientIdentifier = "<client id>"
provider.ClientSecret = "<client secret>"
Dim auth = New OAuth2Authenticator(Of NativeApplicationClient)(provider, AddressOf GetAuthorization)
Dim service = New CalendarService(auth)
End Sub
Private Shared Function GetAuthorization(arg As NativeApplicationClient) As IAuthorizationState
Dim scopes As New System.Collections.Generic.List(Of String)
scopes.Add(CalendarService.Scopes.Calendar.GetStringValue())
Dim state As IAuthorizationState = New AuthorizationState(scopes)
state.Callback = New Uri(NativeApplicationClient.OutOfBandCallbackUrl)
Dim authUri As Uri = arg.RequestUserAuthorization(state)
Process.Start(authUri.ToString())
Return arg.ProcessUserAuthorization(state)
End Function
我收到一个错误;Error1“IAuthorizationState”在命名空间“DotNetOpenAuth.OAuth2”中不明确。
我不知道我做错了什么(我遵循 Google api 手册的每一步,也有所有需要的 DLL)
希望有人可以帮助我。
提前感谢您的努力!:)