Skip to content

Instantly share code, notes, and snippets.

@ankkal
Created April 4, 2018 12:56
Show Gist options
  • Save ankkal/2f6d8d7e89f5f5bec37724b34187ac5b to your computer and use it in GitHub Desktop.
Save ankkal/2f6d8d7e89f5f5bec37724b34187ac5b to your computer and use it in GitHub Desktop.
try {
consentToken = this.event.context.System.user.permissions.consentToken;
deviceId = this.event.context.System.device.deviceId;
apiEndpoint = this.event.context.System.apiEndpoint;
if(!consentToken || !deviceId || !apiEndpoint) {
throw("User did not give us permissions to access their address.");
}
} catch(e) {
this.emit(":tellWithPermissionCard", Messages.NOTIFY_MISSING_PERMISSIONS, PERMISSIONS);
// Lets terminate early since we can't do anything else.
console.log(JSON.stringify(this.event));
console.error(e);
console.info("Ending getAddressHandler()");
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment