private static void AttemptLogin() { if (ApiCredentials.Load()) { System.Action <bool> onAuthed = delegate(bool isSuccess) { if (isSuccess) { refreshWindow = true; } else { Login(); } }; switch (ApiCredentials.GetAuthTokenProvider()) { case "vrchat": AuthenticateWithVRChat(onAuthed); break; } } else { Login(); } }
public void SetCredentials(string aApiKey, string aApiSecret) { ApiCredentials lCredentials = new ApiCredentials(aApiKey, aApiSecret); BittrexClientOptions lClientOptions = new Bittrex.Net.Objects.BittrexClientOptions { ApiCredentials = lCredentials }; BittrexSocketClientOptions lSocketOptions = new Bittrex.Net.Objects.BittrexSocketClientOptions { ApiCredentials = lCredentials }; BittrexClient.SetDefaultOptions(lClientOptions); BittrexSocketClient.SetDefaultOptions(lSocketOptions); using (BittrexClient lClient = new BittrexClient()) { CallResult <BittrexBalance> lResponse = lClient.GetBalanceAsync("BTC").Result; if (!lResponse.Success) { throw new PandoraExchangeExceptions.InvalidExchangeCredentials("Incorrect Key Pair for selected exchange"); } } //Note: I generate a new instance of ApiCredentials because internally the library dispose it FUserCredentials = new Tuple <string, string>(aApiKey, aApiSecret); IsCredentialsSet = true; }
public BinanceRequestPostOrder(object param, ApiCredentials credentials, bool test = false) : base(param, credentials) { string testOrder = test ? "/test" : ""; Method = HttpMethod.Post; RequestUri = new Uri(BaseAddress, $"/api/v3/order{ testOrder }{ QueryString }"); }
new void Start() { if (!Application.isEditor || !Application.isPlaying) { return; } base.Start(); Application.runInBackground = true; UnityEngine.VR.VRSettings.enabled = false; uploadButton.onClick.AddListener(SetupUpload); shouldUpdateImageToggle.onValueChanged.AddListener(ToggleUpdateImage); releasePublic.gameObject.SetActive(false); ApiCredentials.Load(); APIUser.Login( delegate(APIUser user) { pipelineManager.user = user; UserLoggedInCallback(user); }, delegate(string err) { blueprintPanel.SetActive(false); errorPanel.SetActive(true); } ); }
public static void Init() { if (!RemoteConfig.IsInitialized()) { RemoteConfig.Init(); } if (isInitialized) { return; } if (!APIUser.IsLoggedInWithCredentials && ApiCredentials.Load()) { APIUser.Login((user) => AnalyticsSDK.LoggedInUserChanged(user), null); } clientInstallPath = SDKClientUtilities.GetSavedVRCInstallPath(); if (string.IsNullOrEmpty(clientInstallPath)) { clientInstallPath = SDKClientUtilities.LoadRegistryVRCInstallPath(); } signingIn = false; isInitialized = true; VRCContentManagerWindow.ClearContent(); }
public HitBTCRestAuthenticationProvider(ApiCredentials credentials) : base(credentials) { if (credentials.Secret == null) { throw new ArgumentException("ApiKey/Secret needed"); } }
private KunaClient GetClientWithAuthentication(bool pro) { var config = new ConfigurationBuilder().AddJsonFile("keys.json").Build(); var key = config["key"]; var secret = config["secret"]; ApiCredentials c = string.IsNullOrEmpty(key) ? null : new CryptoExchange.Net.Authentication.ApiCredentials(key, secret); var client = new KunaClient(new KunaClientOptions() { ApiCredentials = c, LogLevel = LogLevel.Debug, LogWriters = new List <ILogger>() { new DebugLogger(), new ConsoleLogger() }, IsProAccount = pro, //RateLimiters = new List<CryptoExchange.Net.Interfaces.IRateLimiter>() { new RateLimiterTotal(1100, TimeSpan.FromMinutes(1)) }, //RateLimitingBehaviour = CryptoExchange.Net.Objects.RateLimitingBehaviour.Fail, RequestTimeout = TimeSpan.FromSeconds(4) }); return(client); }
public static void Init() { if (isInitialized) { return; } // make sure the api url is set correctly before attempting to log in RefreshApiUrlSetting(); if (!APIUser.IsLoggedInWithCredentials && ApiCredentials.Load()) { APIUser.FetchCurrentUser((c) => AnalyticsSDK.LoggedInUserChanged(c.Model as APIUser), null); } clientInstallPath = SDKClientUtilities.GetSavedVRCInstallPath(); if (string.IsNullOrEmpty(clientInstallPath)) { clientInstallPath = SDKClientUtilities.LoadRegistryVRCInstallPath(); } signingIn = false; isInitialized = true; VRCContentManagerWindow.ClearContent(); }
public void SetRequestCredentials(ApiCredentials credentials) { if (credentials == null) { throw new ArgumentNullException("credentials"); } if (string.IsNullOrWhiteSpace(credentials.ApiType)) { throw new ArgumentNullException(credentials.ApiType); } if (string.IsNullOrWhiteSpace(credentials.ApiVersion)) { throw new ArgumentNullException(credentials.ApiVersion); } if (string.IsNullOrWhiteSpace(credentials.UserName)) { throw new ArgumentNullException(credentials.UserName); } if (string.IsNullOrWhiteSpace(credentials.UserPassKey)) { throw new ArgumentNullException(credentials.UserPassKey); } ApiType = credentials.ApiType; ApiVersion = credentials.ApiVersion; UserName = credentials.UserName; UserPassKey = credentials.UserPassKey; }
public ParibuAuthenticationProvider(ApiCredentials credentials) : base(credentials) { if (credentials.Key == null || credentials.Secret == null) { throw new ArgumentException("No valid API credentials provided. Key/Secret needed."); } }
public async Task AddApiCredentials(Capability capability, ApiCredentials apiCredentials, string clusterId) { var ssmClient = new AmazonSimpleSystemsManagementClient(RegionEndpoint.EUCentral1); await ssmClient.PutParameterAsync(new PutParameterRequest { Type = ParameterType.SecureString, Name = $"/capabilities/{capability.RootId}/kafka/{clusterId}/credentials", Tier = ParameterTier.Standard, Value = JsonConvert.SerializeObject(new { Key = apiCredentials.Key, Secret = apiCredentials.Secret }), Tags = new List <Tag> { new Tag { Key = "capabilityName", Value = capability.Name }, new Tag { Key = "capabilityId", Value = capability.Id }, new Tag { Key = "capabilityRootId", Value = capability.RootId }, new Tag { Key = "createdBy", Value = "Kafka-Janitor" } } }); }
new void Start() { if (!Application.isEditor || !Application.isPlaying) { return; } base.Start(); Application.runInBackground = true; UnityEngine.XR.XRSettings.enabled = false; uploadButton.onClick.AddListener(SetupUpload); shouldUpdateImageToggle.onValueChanged.AddListener(ToggleUpdateImage); releasePublic.gameObject.SetActive(false); ApiCredentials.Load(); APIUser.Login( delegate(APIUser user) { UserLoggedInCallback(user); }, delegate(string err) { VRC.Core.Logger.LogError("Could not log in - " + err, DebugLevel.Always); blueprintPanel.SetActive(false); errorPanel.SetActive(true); } ); }
private TerminalRouteResponse GetOffline(string key, ApiCredentials rootCredentials) { var cacheFile = ResolveOfflineRouteCacheLocation(key); if (!File.Exists(cacheFile)) { return(null); } string rawContent = ReadFile(cacheFile); try { var result = JsonConvert.DeserializeObject <TerminalRouteResponse>(rawContent); result.TransientCredentials = Decrypt(result.TransientCredentials, rootCredentials); return(result); } catch (JsonException) { // File is invalid, remove it DeleteFile(cacheFile); return(null); } }
// GET: api/Report/ThisWeek/{workspaceKey} public Report GetThisWeek(string workspaceKey) { string domain = Properties.Settings.Default.Domain; string workspaceEndpoint = Properties.Settings.Default.WorkspaceEndpoint; string reportEndpoint = Properties.Settings.Default.ReportEndpoint; string apiPassword = Properties.Settings.Default.DefaultApiPassword; string apiToken = WebUtil.GetHeader("ApiToken", Request.Headers); string email = WebUtil.GetHeader("Email", Request.Headers); var paths = new ApiPaths(domain, workspaceEndpoint, reportEndpoint); var parameters = new ApiParameters() { WorkspaceKey = workspaceKey, Since = DateTime.Today, Until = DateTime.Today.AddDays(7) }; var credentials = new ApiCredentials { ApiKey = apiToken, ApiPassword = apiPassword, Email = email }; var context = new ApiContext(paths, credentials, parameters); return(new TogglApiRequest(context).GetReport()); }
private IObservable <OrderBook> GetRawOrderBooks() { var creds = new ApiCredentials { ApiKey = _orderBookSettings.WebSocketCredentials.ApiKey, ApiSecret = _orderBookSettings.WebSocketCredentials.ApiSecret, UserId = _orderBookSettings.WebSocketCredentials.UserId }; var restApi = new CexIoRestClient(creds, _orderBookSettings.CurrencyMapping, _logFactory); _log.Info("Retrieving existing pairs"); var pairs = GetPairs(restApi).Result; _log.Info($"{pairs.Count} retrieved"); var timeouts = new WebSocketTimeouts( readTimeout: _orderBookSettings.Timeouts.SocketInactivity, connectTimeout: _orderBookSettings.Timeouts.WebSocketConnect, writeToSocket: _orderBookSettings.Timeouts.WriteToSocket); var wsClient = new CexIoListener(pairs, creds, timeouts, _log); var orderbooks = wsClient.Messages .Select(x => x.Message as IOrderBookMessage) .Where(x => x != null) .GroupBy(x => x.Pair) .SelectMany(ProcessSingleInstrument); return(orderbooks); }
public static void Init() { if (!RemoteConfig.IsInitialized()) { RemoteConfig.Init(); } if (isInitialized) { return; } if (!APIUser.IsLoggedInWithCredentials && ApiCredentials.Load()) { APIUser.Login(null, null); } clientInstallPath = SDKClientUtilities.GetSavedVRCInstallPath(); if (string.IsNullOrEmpty(clientInstallPath)) { clientInstallPath = SDKClientUtilities.LoadRegistryVRCInstallPath(); } signingIn = false; isInitialized = true; }
/// <inheritdoc /> public void SetApiCredentials(ApiCredentials credentials) { foreach (var apiClient in ApiClients) { apiClient.SetApiCredentials(credentials); } }
public SwitcheoAuthenticationProvider(ApiCredentials credentials, BlockchainType keyType) : base(new ApiCredentials(new PrivateKey(EnsureHexFormat(credentials.PrivateKey.Key, credentials.PrivateKey?.Passphrase)))) { if (this.CanSign) { if (keyType == BlockchainType.Qtum || keyType == BlockchainType.Ethereum) { throw new NotImplementedException(); } try { this.KeyType = keyType; SecureString readablePrivateKey = credentials.PrivateKey.Key; // Decrypting private key if Nep2 format was provided if (WalletsHelper.IsNep2(credentials.PrivateKey.Key)) { readablePrivateKey = Nep2.Decrypt(credentials.PrivateKey.Key.GetString(), credentials.PrivateKey.Passphrase.GetString()).Result.ToHexString().ToSecureString(); } // Extracting wallet informations (public key, script hash, address and fixed address) this.WalletInformations = WalletsHelper.GetWalletInformations(readablePrivateKey, keyType); } catch (Exception) { throw privateKeyException; } } }
/// <summary>Generates request headers for authorization to the BlockChyp gateway.</summary> /// <param name="credentials">API credentials used to generate request headers.</param> public static Dictionary <string, string> GenerateAuthHeaders(ApiCredentials credentials) { var nonce = GenerateNonce(NonceSizeBytes); var timestamp = GetRfc3339Timestamp(); var toSign = credentials.ApiKey + credentials.BearerToken + timestamp + nonce; byte[] key = FromHex(credentials.SigningKey); byte[] payload = Encoding.ASCII.GetBytes(toSign); string signature; using (var hmac = new HMACSHA256(key)) { byte[] hashed = hmac.ComputeHash(payload); signature = ToHex(hashed); } return(new Dictionary <string, string> { [HeaderNonce] = nonce, [HeaderTimestamp] = timestamp, [HeaderAuthorization] = $"{AuthSchemeDual} {credentials.BearerToken}:{credentials.ApiKey}:{signature}", }); }
void Login() { ApiCredentials.Load(); APIUser.Login( delegate(APIUser user) { pipelineManager.user = user; if (isUpdate) { ApiAvatar.Fetch(pipelineManager.blueprintId, false, delegate(ApiAvatar avatar) { apiAvatar = avatar; SetupUI(); }, delegate(string message) { apiAvatar = new ApiAvatar(); apiAvatar.id = pipelineManager.blueprintId; SetupUI(); }); } else { apiAvatar = new ApiAvatar(); apiAvatar.id = pipelineManager.blueprintId; SetupUI(); } }, LoginErrorCallback); }
public MainForm(ApiCredentials credentials) { if (credentials == null) { throw new ArgumentNullException(nameof(credentials)); } _api = new Api(credentials); InitializeComponent(); Size = new Size(800, 500); _directoryBrowser.FileBrowserManager = _fileBrowser.FileBrowserManager = new FileBrowserManager(); var filesPath = Path.Combine(Program.DataPath, "Files"); Directory.CreateDirectory(filesPath); _directoryBrowser.Root = filesPath; UpdateEnabled(); Text = $"{Text} - {credentials.Company}\\{credentials.UserName} - {credentials.Url}"; var handle = _copyDataTarget.Handle; // Force creation of the handle. _copyDataTarget.DataCopied += _copyDataTarget_DataCopied; }
/// <summary> /// Initializes a new instance of the <see cref="GoodreadsClient"/> class. /// Use this constructor if you already have OAuth permissions for the user. /// </summary> /// <param name="apiKey">Your Goodreads API key.</param> /// <param name="apiSecret">Your Goodreads API secret.</param> /// <param name="accessToken">The user's OAuth access token.</param> /// <param name="accessSecret">The user's OAuth access secret.</param> public GoodreadsClient(string apiKey, string apiSecret, string accessToken, string accessSecret) { var client = new RestClient(new Uri(GoodreadsUrl)) { UserAgent = "goodreads-dotnet" }; client.AddDefaultParameter("key", apiKey, ParameterType.QueryString); client.AddDefaultParameter("format", "xml", ParameterType.QueryString); var apiCredentials = new ApiCredentials(client, apiKey, apiSecret, accessToken, accessSecret); // Setup the OAuth authenticator if they have passed on the appropriate tokens if (!string.IsNullOrWhiteSpace(accessToken) && !string.IsNullOrWhiteSpace(accessSecret)) { client.Authenticator = OAuth1Authenticator.ForProtectedResource( apiKey, apiSecret, accessToken, accessSecret); } Connection = new Connection(client, apiCredentials); Authors = new AuthorsClient(Connection); Books = new BooksClient(Connection); Shelves = new ShelvesClient(Connection); Users = new UsersClient(Connection); Reviews = new ReviewsClient(Connection); Series = new SeriesClient(Connection); }
void Login() { ApiCredentials.Load(); APIUser.Login( delegate(APIUser user) { pipelineManager.user = user; API.Fetch <ApiAvatar>(pipelineManager.blueprintId, (c) => { Debug.Log("<color=magenta>Updating an existing avatar.</color>"); apiAvatar = c.Model as ApiAvatar; pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(apiAvatar.authorId); SetupUI(); }, (c) => { Debug.Log("<color=magenta>Creating a new avatar.</color>"); apiAvatar = new ApiAvatar(); apiAvatar.id = pipelineManager.blueprintId; pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(apiAvatar.authorId); SetupUI(); }); }, LoginErrorCallback); }
void Login() { ApiCredentials.Load(); APIUser.Login( delegate(APIUser user) { pipelineManager.user = user; ApiAvatar.Fetch(pipelineManager.blueprintId, false, delegate(ApiAvatar avatar) { apiAvatar = avatar; pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(apiAvatar.authorId); SetupUI(); }, delegate(string message) { apiAvatar = new ApiAvatar(); apiAvatar.id = pipelineManager.blueprintId; pipelineManager.completedSDKPipeline = false; SetupUI(); } ); }, LoginErrorCallback); }
public Response Send(IHostedPciDataConverter converter, ApiCredentials credentials, BaseRequest request) { request.SetRequestCredentials(credentials); var queryString = converter.ConvertToQueryString(request); var responseString = Post(queryString, credentials.GetUrl(request.RequestType)); return(converter.ConvertToResponse(responseString)); }
public Websocket(ApiCredentials credentials) { this.credentials = credentials; this.socket = new PureSocketClusterSocket("wss://sc-02.coinigy.com/socketcluster/"); InitializeEvents(); }
public Startup(IConfiguration configuration) { Configuration = configuration; var appSettingsDev = new ConfigurationBuilder().AddJsonFile("appsettings-dev.json").Build(); _apiCredentials = appSettingsDev.GetSection("ApiCredentials").Get <ApiCredentials>(); }
new void Start() { if (!Application.isEditor || !Application.isPlaying) { return; } base.Start(); IsCurrentWorldInCommunityLabs = false; IsCurrentWorldUploaded = false; IsCurrentWorldPubliclyPublished = false; var desc = pipelineManager.GetComponent <VRC_SceneDescriptor>(); desc.PositionPortraitCamera(imageCapture.shotCamera.transform); Application.runInBackground = true; UnityEngine.XR.XRSettings.enabled = false; uploadButton.onClick.AddListener(SetupUpload); openCommunityLabsDocsButton.onClick.AddListener(OpenCommunityLabsDocumentation); shouldUpdateImageToggle.onValueChanged.AddListener(ToggleUpdateImage); releasePublic.gameObject.SetActive(false); System.Action <string> onError = (err) => { VRC.Core.Logger.LogError("Could not authenticate - " + err, DebugLevel.Always); blueprintPanel.SetActive(false); errorPanel.SetActive(true); }; if (!ApiCredentials.Load()) { onError("Not logged in"); } else { APIUser.FetchCurrentUser( delegate(ApiModelContainer <APIUser> c) { UserLoggedInCallback(c.Model as APIUser); }, delegate(ApiModelContainer <APIUser> c) { onError(c.Error); } ); } #if !COMMUNITY_LABS_SDK publishToCommunityLabsPanel.gameObject.SetActive(false); #endif }
public KrakenAuthenticationProvider(ApiCredentials credentials) : base(credentials) { if (credentials.Secret == null) { throw new ArgumentException("ApiKey/Secret needed"); } encryptor = new HMACSHA512(Convert.FromBase64String(credentials.Secret.GetString())); }
public void Init() { credentials = new ApiCredentials( "userId", "apiKey", "apiSecret" ); client = new CexClient(); }