Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Babak 1 post 71 karma points
    Nov 04, 2019 @ 17:12
    Babak
    0

    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:

    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.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies