0
我需要讓人們帳號正在訪問我的網頁...我按照以下istructions: https://developers.facebook.com/docs/authentication/signed_request/獲取Facebook的用戶名
伊夫寫下面的代碼:
string _authorizationUrl = string.Format("https://www.facebook.com/dialog/oauth?client_id={0}&redirect_uri={1}", FB_APPID, Server.UrlEncode(FB_CANVAS_PAGE));
string _signedRequest = Request["signed_request"] as string;
string[] _valuesInRequest = _signedRequest.Split(new char[] {'.'}, 2);
string _stringToDecode = _valuesInRequest[1].Replace("-_","+/");
System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
System.Text.Decoder decoder = encoding.GetDecoder();
byte[] _byteToDecode = Convert.FromBase64String(_stringToDecode);
int charCount = decoder.GetCharCount(_byteToDecode, 0, _byteToDecode.Length);
char[] _decodedChar = new char[charCount];
decoder.GetChars(_byteToDecode, 0, _byteToDecode.Length, _decodedChar, 0);
string result = new String(_decodedChar);
林登錄Facebook的我得到這個結果:
{"algorithm":"HMAC-SHA256","issued_at":1316602539,"page":{"id":"XXXXXX","liked":false,"admin":false},"user":{"country":"it","locale":"it_IT","age":{"min":21}}}
沒有信息aabout用戶名。爲什麼?任何人都可以幫我嗎?
謝謝