コード例 #1
0
        public async Task <DTO.TokenResponse> GetToken(DTO.AccessConfig config)
        {
            string authorizationMethod = "Basic";
            string authorizationToken  = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{config.userName}:{config.password}"));

            var headers = new Dictionary <string, string>()
            {
                { "client_id", config.client_id }
            };

            var token = await this.CallWebApiAsync <DTO.TokenResponse>(HttpMethod.Post, this._url + "/account/token", authorizationMethod : authorizationMethod, authorizationToken : authorizationToken, headers : headers);

            return(token);
        }
コード例 #2
0
        public async Task TestInitialize()
        {
            _apiProxy = new ContenidoProxy(urlProxy);
            var config = new DTO.AccessConfig
            {
                userName  = "******",
                password  = "******",
                client_id = "download-offline_dev"
            };

            _token = await _apiProxy.GetToken(config);

            _apiProxy.Token = _token;
        }