void PopulateAssets(string search = null) { LootLockerSDKAdminManager.DebugMessage("Getting assets.."); currentView = LootLockerView.Loading; LootLockerSDKAdminManager.GetAssets((response) => { LootLockerSDKAdminManager.GetContexts((contextResponse) => { if (contextResponse.success) { Contexts = contextResponse.Contexts; ContextNames = Contexts.Select(x => x.name).ToArray(); LootLockerSDKAdminManager.DebugMessage("Successful got all contexts: " + contextResponse.text); } else { LootLockerSDKAdminManager.DebugMessage("failed to get all contexts: " + contextResponse.Error, true); } if (response.success) { assetsResponse = response; currentView = LootLockerView.Assets; Repaint(); LootLockerSDKAdminManager.DebugMessage("Successful got all assets: " + response.text); } else { LootLockerSDKAdminManager.DebugMessage("failed to get all assets: " + response.Error, true); } }); }, search); }
public void SetupTwoFactorAuthentication() { LootLockerSDKAdminManager.SetupTwoFactorAuthentication((response) => { if (response.success) { LootLockerSDKAdminManager.DebugMessage("Successful setup two factor authentication: " + response.text); } else { LootLockerSDKAdminManager.DebugMessage("failed to set two factor authentication: " + response.Error, true); } }); }
protected override void RefreshTokenAndCompleteCall(LootLockerServerRequest cacheServerRequest, Action <LootLockerResponse> OnServerResponse) { var authRequest = new LootLockerInitialAuthRequest(); authRequest.email = activeConfig.email; authRequest.password = activeConfig.password; LootLockerAPIManagerAdmin.InitialAuthenticationRequest(authRequest, (response) => { if (response.success) { Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("x-auth-token", activeConfig.token); cacheServerRequest.extraHeaders = headers; if (cacheServerRequest.retryCount < 4) { SendRequest(cacheServerRequest, OnServerResponse); cacheServerRequest.retryCount++; } else { LootLockerSDKAdminManager.DebugMessage("Admin token refresh failed"); LootLockerResponse res = new LootLockerResponse(); res.statusCode = 401; res.Error = "Admin token Expired"; res.hasError = true; OnServerResponse?.Invoke(res); } } else { LootLockerSDKAdminManager.DebugMessage("Admin token refresh failed", true); LootLockerResponse res = new LootLockerResponse(); res.statusCode = 401; res.Error = "Admin token Expired"; res.hasError = true; OnServerResponse?.Invoke(res); } }); }