私は承認されたaccess_tokenからGoogle認定資格を作成するにはどうすればよいですか?
{{
"access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"expires_in": "3600",
"refresh_token": "xxxxxxxxxxxxxxxxxx",
"token_type": "Bearer",
}}
...このようなのOAuth2トークンを持っていると私は(このように?)
Service = new DriveService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "foo",
});
... DriveServiceオブジェクトを作成しようとしてい
けど明らかにこれを正しく行っていないし、ドキュメントを見つけるのが難しいです。
{のSystem.InvalidOperationException:JSONからの作成中にエラーが発生しまし資格
は、私は次の例外を取得しDriveService
GoogleCredential credential = GoogleCredential.FromJson(credentialAsSerializedJson).CreateScoped(GoogleDriveScope);
に渡すGoogleCredential
を作成しようとします。認識できない認証情報タイプ。
私はこれについて完全に間違った方法ですか?
(これはthe sample code contextある)
私はC#に精通していませんが、[OAuth 2.0 in C#](https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth#web- applications-aspnet-mvc)は、許可されたaccess_tokenでdriveServiceを作成するのに役立ちます。これは、ユーザー資格情報とServiceAccountCredentialを区別するためのガイドも提供します。お役に立てれば。 –