1
我試圖爲我的xamarin應用程序實現Twitter身份驗證。我在開發者控制檯檢查了來自用戶的請求電子郵件地址選項,但我無法獲取用戶信息中的電子郵件。我是否做錯了如何使用Xamarin.Auth庫獲取Twitter用戶電子郵件
var Twitterauth = new OAuth1Authenticator(
consumerKey: "XXXX",
consumerSecret: "XXX",
requestTokenUrl:new Uri("https://api.twitter.com/oauth/request_token"),
authorizeUrl: new Uri("https://api.twitter.com/oauth/authorize"),
accessTokenUrl: new Uri("https://api.twitter.com/oauth/access_token"),
callbackUrl: new Uri("http://www.isportfoy.com.tr/tr/anasayfa")
);
Twitterauth.Completed += (s, ee) =>
{
if (ee.IsAuthenticated)
{
var request = new OAuth1Request(
"GET",
new Uri("https://api.twitter.com/1.1/account/verify_credentials.json"),
null,
ee.Account);
request.GetResponseAsync().ContinueWith(t =>
{
var res = t.Result;
var resString = res.GetResponseText();
Console.WriteLine("Result Text: " + resString);
});
}
else
{
}
};
謝謝。顯然你必須將它們作爲參數添加......作爲休閒。 Dictionary param = new Dictionary (); param.Add(「include_email」,「true」); \t \t \t \t \t變種請求=新OAuth1Request( 「GET」,newUri( 「https://api.twitter.com/1.1/account/verify_credentials.json」), \t PARAM, \t ee.Account); 。 \t request.GetResponseAsync()ContinueWith(T => \t { \t \t變種解析度= t.Result; \t \t變種resString = res.GetResponseText(); \t}); –
對不起,我不清楚,但是,這的確是我的意思。您需要將此字段作爲請求的參數發送。 – apineda