Missing libraries for using oAuth2 with google drive on .Net

I am trying to get the example code working in VB .Net I imported the example Oauth.

The example on the google Drive website is here from where I imported the sample code into VB.Net https://developers.google.com/drive/credentials

It has these two references

 Imports Google.Apis.Oauth2.v2
 Imports Google.Apis.Oauth2.v2.Data

I cannot find the libraries in the downloads for the libraries above and I getting errors here in the code:

    Dim credentials As IAuthorizationState = ExchangeCode(authorizationCode)
    Dim userInfo As Userinfo = GetUserInfo(credentials)
Dim userId As [String] = userInfo.Id
emailAddress = userInfo.Email

As userInfo is not defined anywhere. Is it in the missing .dll files?

And

    Dim userInfoService As New Oauth2Service(GetAuthenticatorFromState(credentials))
    Dim userInfo As Userinfo = Nothing

Oauth2Service cannot be found?

What am I doing wrong here?


The library you are looking for has a DLL reference, but you have to extract it twice.

Once you extract the initial download (http://code.google.com/p/google-api-dotnet-client/wiki/APIs#Google_OAuth2_API), there should be a few zip files in that folder, along with "Lib" and "dependencies" one of them should be:

google-oauth2-v2-rev38-csharp-1.3.0-beta-src.zip or google-oauth2-v2-rev38-csharp-1.3.0-beta-bin.zip 在这里输入图像描述

Extract the zip file that has the binary, and the Google.Apis.Oauth2.v2 dll should be there for you to import into the project.

This should fix the error. It's not obvious, it took me a bit to figure out the situation. This is basically how all the APIs that you download for the .Net library are structured.

I hope this helps.


Oauth2是一项独立服务,具有其他二进制文件,可从http://code.google.com/p/google-api-dotnet-client/wiki/APIs#Google_OAuth2_API下载

链接地址: http://www.djcxy.com/p/63052.html

上一篇: 为Google Drive API集成预防Google OAuth 2.0重定向

下一篇: 在.Net上使用oAuth2与谷歌驱动器丢失的库