public void StaffTokenTest()
        {
            StaffInfoDataModel staff = new StaffInfoDataModel
                {
                    Username = "******",
                    Password = "******",
                    Scope = "urn:mboframeworkapi",
                    GrantType = "password",
                    SubscriberId = -4926
                };

            Staff staffCalls = new Staff(null, null);

            IRestResponse response = staffCalls.StaffToken(staff);

            Console.WriteLine(response.Content);

            Assert.AreNotEqual(0, response.ContentLength);
        }
Esempio n. 2
0
        public IRestResponse StaffToken(StaffInfoDataModel staff)
        {
            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 = staff.Username,
                    password = staff.Password,
                    scope = staff.Scope,
                    grant_type = staff.GrantType,
                    subscriberid = staff.SubscriberId
                });

            return client.Execute(request);
        }