Ejemplo n.º 1
0
        public IActionResult Login(userLogin user)
        {
            userb = new usersAuth();
            var response = userb.loginAuth(user);
            var json     = response.Content.ReadAsStringAsync();

            if (!response.IsSuccessStatusCode)
            {
                Console.WriteLine("Se presento un Error");
                return(BadRequest(json.Result));
            }
            else
            {
                Console.WriteLine("Success");
                return(Ok(json.Result));
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> LoginAsync(userLogin user)
        {
            userb = new usersAuth();
            var response = userb.loginAuth(user);

            var json = await response.Content.ReadAsStringAsync();

            userFirebase claims = null;

            claims = JsonConvert.DeserializeObject <userFirebase>(json.ToString(), new JsonSerializerSettings()
            {
                MissingMemberHandling = MissingMemberHandling.Ignore
            });


            var result = userb.GetrRolxID(claims.displayName);

            var jsonRol = await result.Content.ReadAsStringAsync();

            usersWithROL rol = null;

            rol = JsonConvert.DeserializeObject <usersWithROL>(jsonRol.ToString(), new JsonSerializerSettings()
            {
                MissingMemberHandling = MissingMemberHandling.Ignore
            });

            claims.rol  = rol.rol;
            claims.rute = rol.rute;


            if (!response.IsSuccessStatusCode)
            {
                Console.WriteLine("Se presento un Error");
                return(BadRequest(claims));
            }
            else
            {
                Console.WriteLine("Success");
                return(Ok(claims));
            }
        }