How to Get The Current Logged in Umbraco Back Office User

Image of author Stephen Garside
Stephen Garside Wed 01 Jan 25 2min read

There are occasions when you may want to get the current logged in user for the Umbraco Back Office.  In Umbraco 13 this is really easy to do, so here is a simple example of getting the back office logged in user:

Within your controller, inject the IBackOfficeSecurityAccessor:

private readonly IBackOfficeSecurityAccessor _backOfficeSecurityAccessor;
public MyUmbracoPluginController(IBackOfficeSecurityAccessor backOfficeSecurityAccessor)
{
_backOfficeSecurityAccessor = backOfficeSecurityAccessor;
}

Then, to get the Umbraco logged in user its as simple as:

IUser? currentUser = _backOfficeSecurityAccessor.BackOfficeSecurity.CurrentUser;

And thats all there is to getting the current logged in back office user in Umbraco.