Skip to Content

Not able to get results from $.session.getUsername()

Hi All,

I get output as 'undefined' with the below code

Please help

var user = $.session.getUsername();
	 $.response.contentType = 'text/html';
 		$.response.setBody(user);
 		$.response.status = 404;
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Feb 11 at 09:00 AM

    I think you are using an anonymous access, without forcing the user to authenticate e.g. by an XSUAA service instance. With an anonymous access, $.session.getUsername has nothing to return.

    Add comment
    10|10000 characters needed characters exceeded