コード例 #1
0
        /// <summary>
        /// Login to netatmo and retrieve an OAuthToken
        /// </summary>
        /// <param name="scopes"></param>
        public async void Login(NetatmoScope[] scopes)
        {
            var content  = HttpContentCreator.CreateLoginHttpContent(ClientId, ClientSecret, AppConstants.NetatmoAccount, AppConstants.NetatmoPassword, scopes);
            var response = await Request <OAuthAccessToken>(AppConstants.NetatmoRequestTokenUrl, content, true);

            if (response.Success)
            {
                OAuthAccessToken = response.Result;
                OnLoginSuccessful();
            }
            else
            {
                OnLoginFailed();
            }
        }