Exemplo n.º 1
0
        public string GetRefreshToken(string code, string client_id, string client_secret, string redirect_uri)
        {
            string postData = "code=" + code + "&client_id=" + client_id + "&client_secret=" + client_secret + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code";
            string result   = objoAuth.WebRequest(GlobusGooglePlusLib.Authentication.oAuthToken.Method.POST, Globals.strRefreshToken, postData);

            return(result);
        }
        /// <summary>
        /// After the web server receives the authorization code, it may exchange the authorization code for an access token and a refresh token.
        /// </summary>
        /// <param name="code">authorization code</param>
        /// <returns></returns>
        public string GetRefreshToken(string code)
        {
            string postData = "code=" + code + "&client_id=" + ConfigurationManager.AppSettings["YtconsumerKey"] + "&client_secret=" + ConfigurationManager.AppSettings["YtconsumerSecret"] + "&redirect_uri=" + ConfigurationManager.AppSettings["Ytredirect_uri"] + "&grant_type=authorization_code";
            string result   = objoAuth.WebRequest(GlobusGooglePlusLib.Authentication.oAuthToken.Method.POST, Globals.strRefreshToken, postData);

            return(result);
        }
Exemplo n.º 3
0
 public string getAnalyticsData(string strProfileId,string metricDimension,string strdtFrom,string strdtTo,string strToken)
 {
     string strData = string.Empty;
     oAuthToken objToken = new oAuthToken();
     try
     {
         string strDataUrl = Globals.strGetGaAnalytics + strProfileId + "&" + metricDimension + "&start-date=" + strdtFrom + "&end-date=" + strdtTo + "&access_token=" + strToken;
         strData=objToken.WebRequest(GlobusGooglePlusLib.Authentication.oAuthToken.Method.GET, strDataUrl, "");
     }
     catch (Exception Err)
     {
         Console.Write(Err.StackTrace);
     }
     return strData;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Delete a moment that your app has written for the authenticated user.
        /// </summary>
        /// <param name="UserId"></param>
        /// <param name="access"></param>
        /// <returns></returns>
        public JArray Remove_Moment(string UserId, string access)
        {
            oAuthToken objToken = new oAuthToken();
            string RequestUrl = Globals.strRemoveMoments + UserId + "?access_token=" + access;
            string response = string.Empty;
            try
            {
                response = objToken.WebRequest(GlobusGooglePlusLib.Authentication.oAuthToken.Method.DELETE, RequestUrl, "");
                if (!response.StartsWith("["))
                    response = "[" + response + "]";
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }

            return JArray.Parse(response);
        }