//TODO: the method throws three exceptions and check for null exception on access_token.
        private string GetUserMailId(string accessToken)
        {
            ZohoHTTPConnector conn = new ZohoHTTPConnector()
            {
                Url = ZohoOAuth.GetUserInfoURL()
            };

            conn.AddHeader("Authorization", ZohoOAuthConstants.AuthHeaderPrefix + accessToken);
            string  response     = conn.Get();
            JObject responseJSON = JObject.Parse(response);

            return(responseJSON["Email"].ToString());
        }
Exemple #2
0
        //TODO: the method throws three exceptions and check for null exception on access_token.
        private string GetUserMailId(string accessToken)
        {
            try
            {
                ZohoHTTPConnector conn = new ZohoHTTPConnector()
                {
                    Url = ZohoOAuth.GetUserInfoURL()
                };

                conn.AddHeader("Authorization", ZohoOAuthConstants.AuthHeaderPrefix + accessToken);

                string response = conn.Get();

                JObject responseJSON = JObject.Parse(response);

                return(responseJSON["Email"].ToString());
            }
            catch (Exception ex)
            {
                ZCRMLogger.LogError(ex);

                throw new ZohoOAuthException("Exception while fetching User email from access token, Make sure AAAserver.profile.Read scope is included while generating the Grant token.");
            }
        }