Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. private void ReadFeatureServices(User user, string admin, string adminpass) {
  2. string savedUrl = GetServerUrl();
  3. if (string.IsNullOrEmpty(savedUrl)) {
  4. NeApiAccess.Instance.Logger.ShowErrorDialog("You do not have a server URL stored, please provide server url OB SERVER FORM");
  5. return;
  6. }
  7.  
  8. var newUser = new UserCreation {
  9. username = user.UserId,
  10. password = user.FirstName,
  11. fullname = user.FullName,
  12. email = user.Email,
  13. description = user.Description
  14. };
  15. string json = JsonConvert.SerializeObject(newUser);
  16. var tokenEnc = GetToken(adminUser, adminPass, savedUrl);
  17. if (tokenEnc == null)
  18. return;
  19. var values = JsonConvert.DeserializeObject<Dictionary<string, object>>(tokenEnc);
  20. if (values.ContainsKey("status")) {
  21. NeApiAccess.Instance.Logger.LogError("Unable to get token");
  22. foreach (var key in values.Keys) {
  23. NeApiAccess.Instance.Logger.LogError(key + ":" + values[key]);
  24. }
  25. return;
  26. }
  27. var token = values["token"].ToString();
  28. // I have the token, the connection. next step here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement