Gib*_*boy 5 javascript google-authentication google-earth-engine
在初始化 API 时,在看似成功的服务身份验证之后,我收到了初始化错误。我们的小组正在反应框架上运行。
这是抛出错误的日志:
Server listening on port 8080...
Authentication server-side EE API calls via private key...
Authentication succeeded!
Error: Permission denied.
at module$contents$ee$apiclient_Call.callback (/Users/Gibbedboy/EPIIC/EPIIC-Project/node_modules/@google/earthengine/build/main.js:21281:62)
at /Users/Gibbedboy/EPIIC/EPIIC-Project/node_modules/@google/earthengine/build/main.js:14985:62
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Initialization failed.
Run Code Online (Sandbox Code Playgroud)
我使用与 github 中的 Google 示例几乎相同的脚本来测试身份验证和初始化:
ee.data.authenticateViaPrivateKey(
PRIVATE_KEY, () => {
console.log('Authentication succeeded!');
// Attempt to initialize Earth Engine.
ee.initialize(
null, null,
// On a successful initialize
() => {
console.log('Successfully initialized the EE client library.');
app.listen(PORT);
console.log(`Listening on port ${PORT}`);
res.send("Authenticated and initialized!\n");
},
// On a failure to initialize
(err) => {
console.log(err);
console.log(`Initialization failed.`);
}
);
},
// When the authentication failed.
(err) => {
console.log(err);
console.log('Authentication failed');
Run Code Online (Sandbox Code Playgroud)
我怀疑身份验证实际上并未成功,因此我仔细检查了我的凭据,结果是正确的。在对我认为可能错误的其他事情进行更多调查后,我不确定是什么导致了这个问题。我仍然怀疑这是一个配置问题,但我和我的团队对 Earth Engine 非常陌生,因此无法在代码编辑器之外进行测试。我们很可能忽略了一些显而易见的事情。
我非常感谢任何有关如何继续的意见或指导。
由于您的主要错误是Permission denied,这意味着您的服务帐户的身份验证存在问题。以下是 Google 服务帐户文档的链接:https://developers.google.com/earth-engine/service_account
创建服务帐户后,您需要注册该帐户才能使用 Google Earth Engine。您所要做的就是向谷歌提交一份表格并请求许可(链接也可以在文档中找到)。等待几天,您的帐户应该经过身份验证才能使用 Google Earth Engine!
| 归档时间: |
|
| 查看次数: |
2453 次 |
| 最近记录: |