On the Actions on Google site I find a function for getting the userID to identify a user across conversations and devices. In the docs section under getUser I read following:
getUser() returns User
Gets the User object. The user object contains information about the user, including a string identifier and personal information (requires requesting permissions, see askForPermissions).
So first i need to request permission. For this i follow the link. But there i find only three permission that can be request.
- NAME
- DEVICE_COARSE_LOCATION
- DEVICE_PRECISE_LOCATION
Theres no permission to granted for the userID. And when i run my code and try getting the userID it return undefined. Getting the userName works fine.
function requestPermissonsIntent(app){
const permission = [app.SupportedPermissions.NAME];
app.askForPermission('Für eine korrekte Ausführung', permission);
}
//later in my code when asking for the userID and userName
if(app.isPermissionGranted()){
const userName = app.getUserName().displayName;
//getting the userName works fine
const userUID = app.getUser().userID;
//userUID is undefinded
...
How can I get the UserID?