コード例 #1
0
        public async Task<bool> Claim(Uri uri, string documentTitle)
        {
            //_token = HubiCHelper.GetAccessTokenFromFragment(uri);

            string code = null;

            foreach (var pair in uri.Query.TrimStart('?').Split('&'))
            {
                var elements = pair.Split('=');
                if (elements.Length != 2)
                {
                    continue;
                }

                switch (elements[0])
                {
                    case "code":
                        code = Uri.UnescapeDataString(elements[1]);
                        break;
                }
            }

            if (code == null) return false;

            _token = await HubiCHelper.ProcessCodeFlowAsync(code);

            return _token != null;
        }
コード例 #2
0
 public void OnTokenUpdated(string access_token, string refresh_token, DateTime expires_in)
 {
     _token = new OAuth2Token(access_token, "bearer", null, refresh_token);
 }