private void GetUserDetailsFromTwitter()
 {
     if (Request["oauth_token"] != null & Request["oauth_verifier"] != null)
     {
         imgTwitter.Visible   = false;
         tbleTwitInfo.Visible = true;
         var oAuth = new oAuthTwitter();
         //Get the access token and secret.
         oAuth.AccessTokenGet(Request["oauth_token"], Request["oauth_verifier"]);
         if (oAuth.TokenSecret.Length > 0)
         {
             //We now have the credentials, so make a call to the Twitter API.
             url = "http://twitter.com/account/verify_credentials.xml";
             xml = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, url, String.Empty);
             XmlDocument xmldoc = new XmlDocument();
             xmldoc.LoadXml(xml);
             XmlNodeList xmlList = xmldoc.SelectNodes("/user");
             foreach (XmlNode node in xmlList)
             {
                 name           = node["name"].InnerText;
                 username       = node["screen_name"].InnerText;
                 profileImage   = node["profile_image_url"].InnerText;
                 followersCount = node["followers_count"].InnerText;
                 noOfTweets     = node["statuses_count"].InnerText;
                 recentTweet    = node["status"]["text"].InnerText;
             }
         }
     }
 }
예제 #2
0
        private void AuthenticateWithTwitter(string returnUrl)
        {
            string url   = "";
            string xml   = "";
            var    oAuth = new oAuthTwitter();

            if (Request["oauth_token"] == null)
            {
                //Redirect the user to Twitter for authorization.
                //Using oauth_callback for local testing.
                oAuth.CallBackUrl = Request.Url.GetLeftPart(UriPartial.Authority) + "/Account/AuthenticatedWithTwitter?state=" + Request["ReturnUrl"];
                Response.Redirect(oAuth.AuthorizationLinkGet(), true);
            }
            else
            {
                //Get the access token and secret.
                oAuth.AccessTokenGet(Request["oauth_token"], Request["oauth_verifier"]);
                if (oAuth.TokenSecret.Length > 0)
                {
                    //We now have the credentials, so make a call to the Twitter API.
                    url = "http://twitter.com/account/verify_credentials.xml";
                    xml = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, url, String.Empty);
                    var response = Server.HtmlEncode(xml);

                    //POST Test
                    //url = "http://twitter.com/statuses/update.xml";
                    //xml = oAuth.oAuthWebRequest(oAuthTwitter.Method.POST, url, "status=" + oAuth.UrlEncode("Hello @swhitley - Testing the .NET oAuth API"));
                    //apiResponse.InnerHtml = Server.HtmlEncode(xml);
                }
            }
        }
예제 #3
0
    protected void FirstPos()
    {
        string url = "";
        string xml = "";

        oAuthTwitter oAuth = new oAuthTwitter();
        oAuth.ConsumerKey = System.Configuration.ConfigurationManager.AppSettings["consumerkey"];
        oAuth.ConsumerSecret = System.Configuration.ConfigurationManager.AppSettings["consumersecret"];
        oAuth.CallBackUrl = SessionState.WebsiteURL + "twitter.aspx";
        if (Request["oauth_token"] == null)
        {
            Response.Redirect(oAuth.AuthorizationLinkGet());
        }
        else
        {
            //Get the access token and secret.
            oAuth.AccessTokenGet(Request["oauth_token"], Request["oauth_verifier"]);
            verifier = Request["oauth_verifier"];
            token = Request["oauth_token"];
            if ((oAuth.TokenSecret.Length > 0))
            {
                //We now have the credentials, so make a call to the Twitter API.
                url = "https://api.twitter.com/1.1/account/verify_credentials.json?test=test&include_entities=true&skip_status=true";
                // url = "https://api.twitter.com/1.1/search/tweets.json";
                xml = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, url, string.Empty);
                CheckAndRegister(xml);
            }
        }
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // if this is a callback that is providing the twitter access token, then update with the token.
        if (!String.IsNullOrEmpty(Request["oauth_token"]) && Page.User.Identity.IsAuthenticated)
        {
            if (String.IsNullOrEmpty(Request["oauth_verifier"]))
            {
                throw new MyFlightbookException("oauth token passed but no oauth_verifier along with it.");
            }

            oAuthTwitter oAuth = new oAuthTwitter();
            oAuth.AccessTokenGet(Request["oauth_token"], Request["oauth_verifier"]);
            mfbTwitter.SetUserTwitterToken(Page.User.Identity.Name, oAuth);
        }


        if (util.GetStringParam(Request, "oauth_token").Length > 0)
        {
            LogbookEntry le = mfbTwitter.PendingFlightToPost;
            if (le != null)
            {
                mfbTwitter.PostFlight(le);
                mfbTwitter.PendingFlightToPost = null; // clear it
            }
        }

        Response.Redirect(SocialNetworkAuthorization.PopRedirect(Master.IsMobileSession() ? SocialNetworkAuthorization.DefaultRedirPageMini : SocialNetworkAuthorization.DefaultRedirPage));
    }
        public IActionResult ReconnectTwtAcc(long userId, string requestToken, string requestSecret, string requestVerifier, bool follow)
        {
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;
            DatabaseRepository dbr   = new DatabaseRepository(_logger, _appEnv);
            oAuthTwitter       OAuth = new oAuthTwitter(_appSettings.twitterConsumerKey, _appSettings.twitterConsumerScreatKey, _appSettings.twitterRedirectionUrl);

            OAuth.AccessToken       = requestToken;
            OAuth.AccessTokenSecret = requestVerifier;
            OAuth.AccessTokenGet(requestToken, requestVerifier);
            string output = Repositories.TwitterRepository.ReconnecTwitter(userId, follow, dbr, OAuth, _logger, _redisCache, _appSettings);

            return(Ok(output));
        }
 public static TwitterAuthInfo TwitterAuthSetPin(ref TwitterAuthInfo acc)
 {
     try
     {
         if (null != acc)
         {
             oAuthTwitter oAuth = new oAuthTwitter(Engine.TWITTER_CONSUMER_KEY, Engine.TWITTER_CONSUMER_SECRET);
             acc = oAuth.AccessTokenGet(ref acc);
         }
     }
     catch (Exception ex)
     {
         FileSystem.AppendDebug("Error while setting Twitter PIN", ex);
     }
     return(acc);
 }
예제 #7
0
        public ActionResult AuthenticatedWithTwitter()
        {
            var oAuth = new oAuthTwitter();

            oAuth.AccessTokenGet(Request["oauth_token"], Request["oauth_verifier"]);

            if (oAuth.UserName.IsNullOrEmpty())
            {
                return(null);
            }
            var userId   = oAuth.UserId;
            var userName = oAuth.UserName;

            if (userId.IsNullOrEmpty())
            {
                return(null);
            }

            var user = userService.GetUser(userId, LoginProvider.Twitter);

            if (user == null)
            {
                user = new User
                {
                    FirstName     = userName,
                    UserName      = userName,
                    LoginProvider = LoginProvider.Twitter,
                    RemoteId      = userId
                };
                user.Id = userService.InsertUser(user, () => Redis.AddUser(user));
            }
            FormsAuthentication.SetAuthCookie(user.Id.ToString(), createPersistentCookie: true);
            var returnUrl = Request["state"];

            if (!returnUrl.IsNullOrEmpty())
            {
                Response.Redirect(returnUrl, true);
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }

            return(null);
        }
        public IActionResult AddTwitterAccount(long userId, long groupId, string requestToken, string requestSecret, string requestVerifier, bool follow)
        {
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;
            DatabaseRepository dbr   = new DatabaseRepository(_logger, _appEnv);
            oAuthTwitter       OAuth = new oAuthTwitter(_appSettings.twitterConsumerKey, _appSettings.twitterConsumerScreatKey, _appSettings.twitterRedirectionUrl);

            OAuth.AccessToken       = requestToken;
            OAuth.AccessTokenSecret = requestVerifier;
            OAuth.AccessTokenGet(requestToken, requestVerifier);
            string output = Repositories.TwitterRepository.AddTwitterAccount(userId, groupId, follow, dbr, OAuth, _logger, _redisCache, _appSettings);

            if (output.Contains("Twitter account already added by you") || output.Contains("This Account is added by other user") || output.Contains("Issue while fetching twitter userId") || output.Contains("Your Twitter profile is not Authorized to add") || output.Contains("Error while Adding Account"))
            {
                return(BadRequest(output));
            }
            else
            {
                return(Ok(output));
            }
        }
예제 #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string       url   = "";
        string       xml   = "";
        oAuthTwitter oAuth = new oAuthTwitter();

        result.Text = DateTime.UtcNow.ToString();
        if (Request["oauth_token"] == null)
        {
            //Redirect the user to Twitter for authorization.
            //Using oauth_callback for local testing.
            oAuth.CallBackUrl = "http://spindate.comstar.co.il/twitter.aspx";
            Response.Redirect(oAuth.AuthorizationLinkGet());
        }
        else
        {
            //Get the access token and secret.
            oAuth.AccessTokenGet(Request["oauth_token"], Request["oauth_verifier"]);
            if (oAuth.TokenSecret.Length > 0)
            {
                //We now have the credentials, so make a call to the Twitter API.
                //   url = "http://twitter.com/account/verify_credentials.xml";
                url = "https://api.twitter.com/1.1/account/verify_credentials.json";
                string data = String.Empty;
                data = "include_entities=false&skip_status=true";

                xml = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, url, data);
                //apiResponse.InnerHtml = Server.HtmlEncode(xml);
                string responseData = Server.HtmlEncode(xml);

                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); //creating a JSON deserializer JSON.
                Rootobject myToken1 = serializer.Deserialize <Rootobject>(xml);
                apiResponse.InnerHtml = myToken1.name;

                //POST Test
                //url = "http://twitter.com/statuses/update.xml";
                //xml = oAuth.oAuthWebRequest(oAuthTwitter.Method.POST, url, "status=" + oAuth.UrlEncode("Hello @swhitley - Testing the .NET oAuth API"));
                //apiResponse.InnerHtml = Server.HtmlEncode(xml);
            }
        }
    }
예제 #10
0
    /// <summary>
    /// Post the flight to Twitter
    /// </summary>
    /// <param name="le">The logbook entry being posted</param>
    /// <returns>true for success</returns>
    public Boolean PostFlight(LogbookEntry le)
    {
        if (le == null)
        {
            throw new ArgumentNullException("le");
        }
        Boolean fResult = false;

        oAuthTwitter oAuth = new oAuthTwitter();

        GetUserTwitterToken(le.User, oAuth);

        if (oAuth.Token.Length == 0 && Request["oauth_token"] == null)
        {
            PendingFlightToPost = le;  // hold on to this logbook entry for post-authorization...

            //Redirect the user to Twitter for authorization.
            oAuth.CallBackUrl = "~/member/PostFlight.aspx".ToAbsoluteURL(Request).ToString();
            SocialNetworkAuthorization.PushRedirect(oAuth.AuthorizationLinkGet());
        }
        else
        {
            if (oAuth.TokenSecret.Length == 0)
            {
                oAuth.AccessTokenGet(Request["oauth_token"], Request["oauth_verifier"]);
                SetUserTwitterToken(Page.User.Identity.Name, oAuth);
            }

            if (new TwitterPoster().PostToSocialMedia(le, Page.User.Identity.Name, Request.Url.Host))
            {
                FDefaultTwitterCheckboxState = true;
                fResult = true;
            }
        }
        return(fResult);
    }
예제 #11
0
        AuthorizeIfRequested()
        {
            AssertValid();

            switch (m_oTwitterAuthorizationControl.Status)
            {
            case TwitterAuthorizationStatus.HasTwitterAccountAuthorized:

                return(true);

            case TwitterAuthorizationStatus.HasTwitterAccountNotAuthorized:

                TwitterAccessToken.Delete();

                // Continue below.

                break;

            default:

                Debug.Assert(false);
                break;
            }

            // Get a Twitter request token.

            oAuthTwitter oTwitterAuth = new oAuthTwitter(
                HttpNetworkAnalyzerBase.UserAgent,
                HttpNetworkAnalyzerBase.HttpWebRequestTimeoutMs);

            Uri oAuthorizationUri = new Uri(oTwitterAuth.AuthorizationLinkGet());

            String sRequestToken = HttpUtility.ParseQueryString(
                oAuthorizationUri.Query)["oauth_token"];

            Debug.Assert(!String.IsNullOrEmpty(sRequestToken));

            // Open the Twitter authorization page.

            Process.Start(oAuthorizationUri.ToString());

            // Tell the user that the Twitter authorization page has been opened in
            // a browser window, and get the PIN that Twitter provides after
            // authorization is complete.

            TwitterAuthorizingDialog oTwitterAuthorizingDialog =
                new TwitterAuthorizingDialog();

            if (oTwitterAuthorizingDialog.ShowDialog(
                    m_oTwitterAuthorizationControl.ParentForm) != DialogResult.OK)
            {
                return(false);
            }

            // Convert the request token to an access token.

            oTwitterAuth.Token = sRequestToken;

            oTwitterAuth.AccessTokenGet(
                sRequestToken, oTwitterAuthorizingDialog.Pin);

            Debug.Assert(!String.IsNullOrEmpty(oTwitterAuth.Token));
            Debug.Assert(!String.IsNullOrEmpty(oTwitterAuth.TokenSecret));

            // Save the access token.

            TwitterAccessToken oTwitterAccessToken = new TwitterAccessToken();

            oTwitterAccessToken.Save(oTwitterAuth.Token, oTwitterAuth.TokenSecret);

            return(true);
        }
예제 #12
0
        /// <summary>
        ///
        /// </summary>
        private void getTwitterUserProfile()
        {
            var requestToken    = (String)Request.QueryString["oauth_token"];
            var requestSecret   = (String)Session["requestSecret"];
            var requestVerifier = (String)Request.QueryString["oauth_verifier"];


            OAuth.AccessToken       = requestToken;
            OAuth.AccessTokenSecret = requestVerifier;
            OAuth.AccessTokenGet(requestToken, requestVerifier);

            JArray profile = userinfo.Get_Users_LookUp_ByScreenName(OAuth, OAuth.TwitterScreenName);
            User   user    = (User)Session["LoggedUser"];
            SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository();
            SocialProfile            socioprofile     = new SocialProfile();

            #region for managing referrals
            ManageReferrals(OAuth);
            #endregion

            foreach (var item in profile)
            {
                try
                {
                    twitterAccount.FollowingCount = Convert.ToInt32(item["friends_count"].ToString());
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twitterAccount.FollowersCount = Convert.ToInt32(item["followers_count"].ToString());
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                twitterAccount.Id          = Guid.NewGuid();
                twitterAccount.IsActive    = true;
                twitterAccount.OAuthSecret = OAuth.AccessTokenSecret;
                twitterAccount.OAuthToken  = OAuth.AccessToken;
                try
                {
                    twitterAccount.ProfileImageUrl = item["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twitterAccount.ProfileUrl = string.Empty;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twitterAccount.TwitterUserId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception er)
                {
                    try
                    {
                        twitterAccount.TwitterUserId = item["id"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception err)
                    {
                        Console.WriteLine(err.StackTrace);
                    }
                    Console.WriteLine(er.StackTrace);
                }

                try
                {
                    twitterAccount.TwitterScreenName = item["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                twitterAccount.UserId = user.Id;

                socioprofile.Id          = Guid.NewGuid();
                socioprofile.ProfileDate = DateTime.Now;
                socioprofile.ProfileId   = twitterAccount.TwitterUserId;
                socioprofile.ProfileType = "twitter";
                socioprofile.UserId      = user.Id;

                if (HttpContext.Current.Session["login"] != null)
                {
                    if (HttpContext.Current.Session["login"].ToString().Equals("twitter"))
                    {
                        User           usr       = new User();
                        UserRepository userrepo  = new UserRepository();
                        Registration   regObject = new Registration();
                        usr.AccountType = "free";
                        usr.CreateDate  = DateTime.Now;
                        usr.ExpiryDate  = DateTime.Now.AddMonths(1);
                        usr.Id          = Guid.NewGuid();
                        usr.UserName    = twitterAccount.TwitterName;
                        usr.Password    = regObject.MD5Hash(twitterAccount.TwitterName);
                        usr.EmailId     = "";
                        usr.UserStatus  = 1;
                        if (!userrepo.IsUserExist(usr.EmailId))
                        {
                            UserRepository.Add(usr);
                        }
                    }
                }

                TwitterStatsRepository objTwtstats = new TwitterStatsRepository();
                TwitterStats           objStats    = new TwitterStats();
                Random rNum = new Random();
                objStats.Id             = Guid.NewGuid();
                objStats.TwitterId      = twitterAccount.TwitterUserId;
                objStats.UserId         = user.Id;
                objStats.FollowingCount = twitterAccount.FollowingCount;
                objStats.FollowerCount  = twitterAccount.FollowersCount;
                objStats.Age1820        = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age2124        = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age2534        = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age3544        = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age4554        = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age5564        = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age65          = rNum.Next(twitterAccount.FollowersCount);
                objStats.EntryDate      = DateTime.Now;
                if (!objTwtstats.checkTwitterStatsExists(twitterAccount.TwitterUserId, user.Id))
                {
                    objTwtstats.addTwitterStats(objStats);
                }
                if (!twtrepo.checkTwitterUserExists(twitterAccount.TwitterUserId, user.Id))
                {
                    twtrepo.addTwitterkUser(twitterAccount);
                    if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                    {
                        socioprofilerepo.addNewProfileForUser(socioprofile);


                        GroupRepository        objGroupRepository = new GroupRepository();
                        SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)HttpContext.Current.Session["GroupName"];
                        Groups lstDetails           = objGroupRepository.getGroupName(team.GroupId);
                        if (lstDetails.GroupName == "Socioboard")
                        {
                            TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository();
                            TeamMemberProfile           teammemberprofile = new TeamMemberProfile();
                            teammemberprofile.Id               = Guid.NewGuid();
                            teammemberprofile.TeamId           = team.Id;
                            teammemberprofile.ProfileId        = twitterAccount.TwitterUserId;
                            teammemberprofile.ProfileType      = "twitter";
                            teammemberprofile.StatusUpdateDate = DateTime.Now;

                            objTeamMemberProfileRepository.addNewTeamMember(teammemberprofile);
                        }
                    }
                    else
                    {
                        socioprofilerepo.updateSocialProfile(socioprofile);
                    }
                }
                else
                {
                    HttpContext.Current.Session["alreadyexist"] = twitterAccount;
                    twtrepo.updateTwitterUser(twitterAccount);
                    TwitterMessageRepository twtmsgreponew = new TwitterMessageRepository();
                    twtmsgreponew.updateScreenName(twitterAccount.TwitterUserId, twitterAccount.TwitterScreenName);
                    if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                    {
                        socioprofilerepo.addNewProfileForUser(socioprofile);
                    }
                    else
                    {
                        socioprofilerepo.updateSocialProfile(socioprofile);
                    }
                }
                if (Session["UserAndGroupsForTwitter"] != null)
                {
                    if (Session["UserAndGroupsForTwitter"].ToString() == "twitter")
                    {
                        try
                        {
                            if (Session["GroupName"] != null)
                            {
                                Groups                 group            = (Groups)Session["GroupName"];
                                GroupProfile           groupprofile     = new GroupProfile();
                                GroupProfileRepository groupprofilerepo = new GroupProfileRepository();
                                groupprofile.Id           = Guid.NewGuid();
                                groupprofile.ProfileId    = socioprofile.ProfileId;
                                groupprofile.ProfileType  = "twitter";
                                groupprofile.GroupOwnerId = user.Id;
                                groupprofile.EntryDate    = DateTime.Now;
                                groupprofile.GroupId      = group.Id;
                                if (!groupprofilerepo.checkGroupProfileExists(user.Id, group.Id, groupprofile.ProfileId))
                                {
                                    groupprofilerepo.AddGroupProfile(groupprofile);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.StackTrace);
                        }
                    }
                }
            }
        }
예제 #13
0
        private void Page_Load(object sender, EventArgs e)
        {
            string url = "";

            _callType = Request.QueryString["type"];

            if (_callType == "facebook")
            {
                //Get the access token.
                _keyString              = Request.QueryString["state"];
                _receivedClubId         = _keyString.Split('-')[2];
                _receivedCacheKeyPrefix = _keyString.Split('-')[0];
                oFace.AccessTokenGet(Request["code"], _keyString);
                if (oFace.Token.Length > 0)
                {
                    _facebookToken   = oFace.Token;
                    _tokenToBeCached = oFace.Token;
                    //We now have the short lived token, need to get long lived token
                }
            }


            if (_callType == "twitter")
            {
                _keyString              = Request.QueryString["state"];
                _receivedClubId         = _keyString.Split('-')[2];
                _receivedCacheKeyPrefix = _keyString.Split('-')[0];
                _receivedNonce          = _keyString.Split('-')[1];
                _twitterSecretKey       = _twitterSecretKeyPrefix + "-" + _receivedNonce + "-" + _receivedClubId;            //Twitter Secret must be cached so it can be received by social_networking_push
                //uses same random nonce that was provided by caller - now caller knows key
                _tempToken = Request.QueryString["oauth_token"];
                _tempToken = Request["oauth_token"].ToString();

                //Get the access token and secret.
                _twitterVerifier = Request["oauth_verifier"].ToString();
                oTwitter.AccessTokenGet(_tempToken, _twitterVerifier);
                if (oTwitter.Token.Length > 0)
                {
                    _twitterToken    = oTwitter.Token;
                    _twitterSecret   = oTwitter.TokenSecret;
                    _tokenToBeCached = oTwitter.Token;
                    //We now have the credentials, so we can start making API calls
                }
            }
            //LinkedIn does not support additional Query parameters, so prefix/key had to be stored in "state" parameter. If we hit this page without a type, it's linkedin.
            if (string.IsNullOrEmpty(_callType))
            {
                _keyString = Request["state"];
                if (!String.IsNullOrEmpty(_keyString))
                {
                    _receivedClubId         = _keyString.Split('-')[2];
                    _receivedCacheKeyPrefix = _keyString.Split('-')[0];
                }
            }

            if (_receivedCacheKeyPrefix == _linkedInCacheKeyPrefix)
            {
                string linkedinCode = Request["code"];
                if (!String.IsNullOrEmpty(linkedinCode))
                {
                    oLinkedIn.AccessTokenGet(linkedinCode);
                    if (oLinkedIn.Token.Length > 0)
                    {
                        _linkedInToken   = oLinkedIn.Token;
                        _tokenToBeCached = oLinkedIn.Token;
                        //We now have the credentials, so we can start making API calls
                    }
                }
            }

            cacheTokens();
        }