public void GetUserTokenTest()
        {
            var user = new RestAuthUser { Username = "******", Password = "******", GrantType = "password", Scope = "urn:mboframeworkapi" };

            Tokens tokensRestCalls = new Tokens();

            IRestResponse response = tokensRestCalls.GetUserToken(user);

            Console.WriteLine(response.Content);

            Console.WriteLine("f**k is it in here");

            Assert.AreNotEqual(0, response.ContentLength);
        }
Ejemplo n.º 2
0
        public IRestResponse GetUserToken(RestAuthUser user)
        {
            var client = new RestClient("https://auth.mbodev.me");

            var request = new RestRequest("/issue/oauth2/token", Method.POST) {RequestFormat = DataFormat.Json};

            request.AddHeader("Content-type", "application/json");
            request.AddHeader("Authorization", "Basic aW50ZWdyYXRpb25fY2xpZW50OnNlY3JldA==");

            request.AddBody(
                new
                {
                    username = user.Username,
                    password = user.Password,
                    scope = user.Scope,
                    grant_type = user.GrantType
                });

            return client.Execute(request);
        }