Get current user email

Hi,

can someone give me a hint on how to get the Email of the current user?

For example, using embedded Form you can get the current user Name by this:

$scope.userName = $rootScope.authentication.name;

Hi @kok,
Try below snip of code.

<script cam-script type="text/form-script">
inject([ '$rootScope', '$scope', 'camAPI', function($rootScope, $scope, camAPI) {

	var userName = $rootScope.authentication.name;
	var User = camAPI.resource('user');

	User.profile({id: userName}, function(err, data) {
		if (!err) {
			//alert('Data: ' + JSON.stringify(data));
			alert('Email: ' + data.email);
		}
	});
}]);
</script>
1 Like