BCXAPI.Service.GetAccessToken C# (CSharp) Метод

GetAccessToken() публичный Метод

step 2: Given a code that the url from GetRequestAuthorizationURL eventually redirects back to and the clientsecret you can get an access token. store this token somewhere as you need to provide it to this wrapper to make calls.
public GetAccessToken ( string code ) : dynamic
code string the code given to you by basecamp
Результат dynamic
        public dynamic GetAccessToken(string code)
        {
            try
            {
                string url = string.Format(_AccessTokenURL, _clientID, _redirectURI, _clientSecret, code);
                var wr = System.Net.HttpWebRequest.Create(url);
                wr.Method = "POST";
                var resp = (System.Net.HttpWebResponse)wr.GetResponse();
                using (var sw = new System.IO.StreamReader(resp.GetResponseStream()))
                {
                    _accessToken = Json.Decode(sw.ReadToEnd());
                }
                return _accessToken;
            }
            catch
            {
                throw new Exceptions.UnauthorizedException();
            }
        }