Céd*_*ier 5 java google-app-engine google-api-java-client google-cloud-datastore google-cloud-platform
我不明白为什么我无法使用 AppEngineDataStoreFactory 保存 AppIdentityCredential
\n\nAppEngineDataStoreFactory newFactory = new AppEngineDataStoreFactory();\nAppIdentityCredential credential = new AppIdentityCredential.Builder(SCOPES).build()\n\n//line with error\nif (newFactory.getDataStore(StoredCredential.DEFAULT_DATA_STORE_ID)\n .set(userId, new StoredCredential(credential))) {\n return credential;\n}\nreturn null;\nRun Code Online (Sandbox Code Playgroud)\n\nAppIdentityCredential 不可序列化,StoredCredential 只接受 Credential 对象...\n逻辑是什么???
\n\nC\xc3\xa9dric
\nStoredCredential(Credential) 方法采用 Credential 对象 [1],而不是 AppIdentityCredential 对象 [2]。
您对该方法使用了错误的对象。
| 归档时间: |
|
| 查看次数: |
932 次 |
| 最近记录: |