gpt4 book ai didi

java - FileDataStoreFactory (Google API) 的特定文件名

转载 作者:行者123 更新时间:2023-11-30 09:09:05 26 4
gpt4 key购买 nike

以前,如果我们使用 FileCredentialStore,我们可以为凭据信息指定存储的文件名。

但是,FileCredentialStore 已贬值

Alternative to setCredentialStore method for google analytics

现在,我们正在使用 FileDataStoreFactory

但是,我们无法再指定保存的文件名了。我们只能指定目录名。文件名将固定为 StoredCredential

有什么方法可以指定文件名吗?因为我有不同的凭据信息,所以我想将它们分组在一个目录中。

最佳答案

像这样:

FileDataStoreFactory dataStoreFactory = new FileDataStoreFactory("/path/to/dir");
DataStore<StoredCredential> dataStore = dataStoreFactory.getDataStore("specificFilename");
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
httpTransport,JSON_FACTORY, clientSecrets, SCOPES)
.setCredentialDataStore(dataStore).build();

关于java - FileDataStoreFactory (Google API) 的特定文件名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23201866/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com