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.

  • fatmazayed 41 posts 122 karma points
    Oct 17, 2023 @ 09:23
    fatmazayed
    0

    i have same issue in umnraco 12

  • iNETZO 134 posts 497 karma points c-trib
    Feb 26, 2024 @ 09:07
    iNETZO
    0

    Same here in Umbraco 13. Did you found a solution?

Please Sign in or register to post replies

Write your reply to:

Draft