Copied to clipboard

Flag this post as spam?

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


  • Steve Miller 7 posts 29 karma points
    Jul 25, 2016 @ 22:40
    Steve Miller
    0

    Using membership with UmbracoApiController

    Hello all,

    I have been searching for a while and would simply like to use the built in membership in Umbraco 7.4.3 to authenticate and authorize members using a custom Api that inherits from the UmbracoApiController. This is not for users on the backoffice, but members on the "front end" of the website.

    I need to get the current logged in member when a page from the website does an Api call.

    It appears to me that Umbraco membership uses FormsAuthentication (cookies) which is fine with me. For simplicity sake and since this application will be launched in a low risk environment I would like to stay away from third party tools. I don't need something more secure like Tokens at this time.

    However if using token based authentication is more straightforward or simpler, I would consider doing it now.

    Thanks.

  • Steve Miller 7 posts 29 karma points
    Jul 26, 2016 @ 06:27
    Steve Miller
    2

    I have figured out my problem. I didn't realize that with the authorization being cookies based some of the Api tools like Postman won't work because they are running in a different HttpContext.

    The following lines were working correctly.

    var memberId = Members.GetCurrentMemberId();
    var currentMember = Members.GetCurrentMemberProfileModel();
    
Please Sign in or register to post replies

Write your reply to:

Draft