Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string GetToken()
- {
- try
- {
- var smartStoreUrl = "http://" + Configuration.Configuration.Config.RsAppServer + "/RS.WebClient.Api/api/account/login";
- var client = new RestClient(smartStoreUrl);
- var request = new RestRequest(Method.POST) { RequestFormat = DataFormat.Json };
- request.AddBody(new { UserName = Configuration.Configuration.Config.RsAppServerUsername, Password = Configuration.Configuration.Config.RsAppServerPassword });
- var response = client.Execute(request);
- if (response.StatusCode == HttpStatusCode.OK)
- {
- var responseObject = JsonConvert.DeserializeObject<LoginObject>(response.Content);
- return responseObject.token;
- }
- return null;
- }
- catch (Exception)
- {
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement