Google Assitant App not storing user information

≯℡__Kan透↙ 提交于 2020-01-25 08:54:04

问题


So I have been following this documentation provided by Google: https://developers.google.com/actions/identity/user-info

Recently, the request.userId was deprecated so Google. So I turned to this documentation which specifies use the conv.user.storage.

I have tried using the storage property in my app but it seems it doesn't store any user data as the next time I access it, the storage generates a new user id key.

const data = "Something you want to save";
let userId;
// if a value for userID exists in user storage, it's a returning user so we can
// just read the value and use it. If a value for userId does not exist in user storage,
// it's a new user, so we need to generate a new ID and save it in user storage.
if ('userId' in conv.user.storage) {
  userId = conv.user.storage.userId;
} else {
  // generateUUID is your function to generate ids.
  userId = generateUUID();
  conv.user.storage.userId = userId
}

Above is the snippet of the code I tried. I've obviously replaced the generateUUID() function with my own and it's generating a random user id every time. The problem is I could never find 'userId' in conv.user.storage.

I also went in my Google Home app, checked out the "[View user storage]" but it had nothing.


回答1:


The userstorage depends on a user setting. Try setting the Web & App permission to on and include the chrome history checkbox.

This setting can be enabled in the activity centre



来源:https://stackoverflow.com/questions/57252258/google-assitant-app-not-storing-user-information

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