有关在 MAUI 应用程序中连接到 google API 并从移动应用程序更新电子表格的正确方法的任何线索。
我已经在谷歌控制台中为电子表格API创建了Andriod凭据,并下载了具有客户端ID的json凭据文件。
以下是代码...
private static string[] SCOPES =
{
SheetsService.Scope.Spreadsheets
};
SheetsService service = new SheetsService(new
BaseClientService.Initializer()
{
HttpClientInitializer =
GoogleWebAuthorizationBroker.AuthorizeAsync(
new ClientSecrets()
{
ClientId = CLIENT_ID,
//This is my client id from json
}, SCOPES, "user", CancellationToken.None, new FileDataStore("MyAppToker")).Result, ApplicationName = APP_NAME
});
上面的代码显示异常为“平台不支持” 当我用谷歌搜索时,我发现谷歌服务不支持环回IP。