Google cloud endpoints. auto_current_user_add and auto_current_user not a working

62 Views Asked by At

I am using endpoints_proto_datastore library by dhermes in my project based on google-endpoints.

Here is my code

class Log(EndpointsModel):

    _message_fields_schema = ('id', 'createdOn', 'author', 'lastUpdatedBy')

    createdOn = ndb.DateTimeProperty(auto_now_add=True)
    author = ndb.UserProperty(auto_current_user_add=True)
    lastUpdatedBy = ndb.UserProperty(auto_current_user=True)


@endpoints.api(name="logs", version="v1", description="Logs API")
class LogsApi(remote.Service):
    @Log.method(user_required=True, path="log/create", name="create")
    def addLog(self, log):
    log.put()
    return log

when I call the API, I get the following response

{
    "createdOn": "2017-07-30T01:08:42.018641",
    "id": "6296903092273152"
}

Why are auto_current_user_add and auto_current_user property not working? What am I doing wrong?

0

There are 0 best solutions below