我正在使用Hammock庫和C#從後面的帖子here中獲取鏈接的用戶的基本配置文件和電子郵件地址。Retrieve Linkedin電子郵件地址
不過,對於我的生活,我不能讓LinkedIn用戶的電子郵件地址。
閱讀this linkedin發佈我得到了新的創建一個新的應用程序來獲得新的鍵,但仍然沒有運氣。
經歷this LinkedIn後,但無法得到它的工作,要麼
我張貼下面的代碼,但它很大程度上提升形式的鏈接我也跟着
var credentials = new OAuthCredentials
{
CallbackUrl = "http://localhost:2715/Callback.aspx",
ConsumerKey = "my consumer key",//not shown
ConsumerSecret = "my consumer secret",//not shown
Type = OAuthType.RequestToken,
};
var client = new RestClient
{
Authority = "https://api.linkedin.com/uas/oauth",
Credentials = credentials
};
//var scope = HttpUtility.UrlEncode("r_basicprofile r_emailaddress");
var request = new RestRequest
{
Path = "requestToken?scope=r_basicprofile+r_emailaddress",
};
我得到這個畫面時用戶導航到linkedin。
要實際要求的電子郵件我使用下面
var request = new RestRequest { Path = "people/~/email-address" };
var credentials = new Hammock.Authentication.OAuth.OAuthCredentials
{
Type = OAuthType.AccessToken,
SignatureMethod = OAuthSignatureMethod.HmacSha1,
ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
ConsumerKey = "my consumer key", //not shown
ConsumerSecret = "my consumer secret", //not shown
Token = Session["AccessToken"].ToString(),
TokenSecret = Session["AccessSecretToken"].ToString(),
Verifier = Session["Verifier"].ToString()
};
var client = new RestClient()
{
Authority = "http://api.linkedin.com/v1/",
Credentials = credentials,
Method = WebMethod.Get
};
var MyInfo = client.Request(request);
String content = MyInfo.Content;
這個代碼這是我得到MyInfo.Content錯誤提前
謝謝您幫幫我。
在嘗試Kamyar的建議時,我收到以下錯誤消息。我還應該嘗試什麼?
謝謝,我整天都在尋找解決方案 – Maysam