warrenbuckley / Umbraco-JWT-AuthTokens

This is a repository for providing a secure based API to perform backoffice actions using JWT Auth tokens
14 stars 19 forks source link

Unable to create member with token #11

Open RyRy79261 opened 7 years ago

RyRy79261 commented 7 years ago

I've been trying to create a member that then creates a token to validate with but I cant get it to work and I cant find in the source code what triggers it as I cant see the save event firing.

public class MemberApiController : UmbracoMemberAuthApiController
{
     [HttpPost]
     public HttpResponseMessage RegisterMember(string username, string email,string password)
        {
            try
            {
                var memberService = Services.MemberService;

                if (!memberService.Exists(username))
                {
                  var member = memberService.CreateWithIdentity(username, email, password, "Member");

                  var testCheck = AuthorisedMember;
                }
            return Request.CreateResponse<string>(HttpStatusCode.OK, "");
            }
            catch (Exception ex)
            {
                return Request.CreateResponse<string>(HttpStatusCode.InternalServerError, ex.Message);
            }
        }
}

This throws a "The given key was not present in the dictionary." error