public async Task <IdentityResult> Register(SnazzleUserDto dto)
        {
            var user = new SnazzleUser {
                UserName = dto.Email, Email = dto.Email, FirstName = dto.FirstName, LastName = dto.LastName
            };
            var result = await _userManager.CreateAsync(user, dto.Password);

            return(result);
        }
        private async Task <IActionResult> SignInAndGetToken(OpenIdConnectRequest request, SnazzleUser user)
        {
            var identity = await _userManager.CreateIdentityAsync(user, request.GetScopes());

            // Add a custom claim that will be persisted
            // in both the access and the identity tokens.
            identity.AddClaim("username", user.UserName,
                              OpenIdConnectConstants.Destinations.AccessToken,
                              OpenIdConnectConstants.Destinations.IdentityToken);

            //identity.AddClaim("roles", user.UserName,
            //    OpenIdConnectConstants.Destinations.AccessToken,
            //    OpenIdConnectConstants.Destinations.IdentityToken);

            // Create a new authentication ticket holding the user identity.
            var ticket = new AuthenticationTicket(
                new ClaimsPrincipal(identity),
                new AuthenticationProperties(),
                OpenIdConnectServerDefaults.AuthenticationScheme);

            ticket.SetResources(request.GetResources());
            ticket.SetScopes(request.GetScopes());
            var signInResult = SignIn(ticket.Principal, ticket.Properties, ticket.AuthenticationScheme);

            return(signInResult);
        }