We have a client (front-end) solution that consumes our Umbraco API (UmbracoApiController), and uses bearer token authentication to authenticate to the API.
In the API method, how do I get access to the user profile?
I have tried:
using Umbraco.Core.Security;
var userTicket = new System.Web.HttpContextWrapper(System.Web.HttpContext.Current).GetUmbracoAuthTicket();
var user = this.ApplicationContext.Services.UserService.GetByUsername(userTicket.Name);
var name = user.Name;
var email = user.Email;
But userTicket is null in the first line.
Our end goal is to get the user's name and email address.
Get user profile on bearer token authentication
We have a client (front-end) solution that consumes our Umbraco API (
UmbracoApiController
), and uses bearer token authentication to authenticate to the API.In the API method, how do I get access to the user profile?
I have tried:
But
userTicket
is null in the first line.Our end goal is to get the user's name and email address.
i have same issue in umnraco 12
Same here in Umbraco 13. Did you found a solution?
is working on a reply...