Example #1
0
        public async void InstagramCompletedAutgenticated(object sender, AuthenticatorCompletedEventArgs eventArgs)
        {
            if (eventArgs.IsAuthenticated)
            {
                Account loggedInAccount = eventArgs.Account;
                var     request         = new OAuth2Request("GET",
                                                            new Uri("https://api.instagram.com/v1/users/self/?access_token=8496248657.f23b40b.fbb30e8c10ff4214ad833e2ea3035deb"),
                                                            null,
                                                            eventArgs.Account);
                var response = await request.GetResponseAsync();

                var json    = response.GetResponseText();
                var jobject = JObject.Parse(json);
                var id_user = jobject["data"]["id"]?.ToString();
                UserInstagramId.SetUserId(id_user);
                OnLoggedInHandler();
            }
        }
Example #2
0
        public async void webviewNavigated(WebView sender, WebNavigatedEventArgs e)
        {
            var accessToken = e.Url;

            string[] cutAccessToken = accessToken.Split('=');
            if (cutAccessToken[0] == "https://www.google.com.ua/#access_token")
            {
                var                 instAccessTokenUrl = new Uri("https://api.instagram.com/v1/users/self/?access_token=" + cutAccessToken[1]);
                HttpClient          httpClient         = new HttpClient();
                HttpResponseMessage response           = await httpClient.GetAsync(instAccessTokenUrl);

                response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();

                responseBody.Split(responseBody[12]);
                var jobject = JObject.Parse(responseBody);
                var id_user = jobject["data"]["id"]?.ToString();
                UserInstagramId.SetUserId(id_user);
                ViewModel.LoginNaVigationAndCreateCommand.Execute();
            }
        }
Example #3
0
        public async void DidFinishNavigation(WKWebView webView, WKNavigation navigation)
        {
            NSUrl token       = webView.Url;
            var   accessToken = token.AbsoluteString;

            string[] cutAccessToken = accessToken.Split('=');
            if (cutAccessToken[0] == "https://www.google.com.ua/#access_token")
            {
                var                 instUrl    = new NSUrl("https://api.instagram.com/v1/users/self/?access_token=" + cutAccessToken[1]);
                HttpClient          httpClient = new HttpClient();
                HttpResponseMessage response   = await httpClient.GetAsync(instUrl);

                response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();

                responseBody.Split(responseBody[12]);
                var jobject = JObject.Parse(responseBody);
                var id_user = jobject["data"]["id"]?.ToString();
                UserInstagramId.SetUserId(id_user);
                ViewModel.LoginNaVigationAndCreateCommand.Execute();
            }
        }