google app engine (spring boot) local testing with data store gives Unauthenticated error

∥☆過路亽.° 提交于 2019-12-20 03:24:24

问题


Google flexible app engine spring boot project running on local with datastore is giving the com.google.cloud.datastore.DatastoreException Unauthenticated exception while saving entity.

{
   "timestamp": 1512077140003,
   "status": 500,
   "error": "Internal Server Error",
   "exception": "com.google.cloud.datastore.DatastoreException",
   "message": "Unauthenticated.",
   "path": "/users"
}

The error description here says the request header does not have valid authentication header, But where to place the auth header does not mentioned.

anybody faced same kind of situation?


回答1:


Canonical Error Code: UNAUTHENTICATED

Description: The com.google.cloud.datastore.DatastoreException simply indicates that the request did not have valid authentication credentials.

Recommended Action: Do not retry without fixing the problem. In this case, you need to check the login credentials again.

More read can be found on this page https://cloud.google.com/datastore/docs/concepts/errors#error_codes

Solution:

Simply you have to run gcloud beta auth application-default login. But I spent a half of a day until found it there. I thought it should be enough to gcloud init. As an alternative, you can use google authentication via Google OAuth2 but that is the hard way.



来源:https://stackoverflow.com/questions/47583059/google-app-engine-spring-boot-local-testing-with-data-store-gives-unauthentica

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!