我正在Xamarin.Forms中编写一个简单的应用程序,允许用户通过社交网站进行身份验证,例如Facebook,Google,Instagram,Twitter等。我使用Xamarin.auth来执行此操作。 Facebook登录时遇到问题。我使用了官方指南中报告的相同代码:
https://components.xamarin.com/gettingstarted/xamarin.auth
但是在应用程序请求用户提供凭据后,响应(在代码中,t.Result.GetResponseText(),第3节)是一个json包含Facebook用户名和姓氏,以及一个名为&#34的字段; ID&#34 ;.相反,我需要用户的所有个人资料信息,例如年龄,性别等。我想我必须使用返回的id来构建对facebook服务的http请求以从id中检索数据。
答案 0 :(得分:2)
您需要在Facebook链接中指定所需的字段。
示例:强>
09-29 00:20:49.194 I/Xposed ( 729): Loading class com.xposed.florian.messengermod.XposedModSendTimestamp
09-29 00:21:28.915 I/Xposed ( 4465): Attempt to hook ConversationMessageView.a
09-29 00:21:28.927 E/Xposed ( 4465): de.robv.android.xposed.XposedHelpers$ClassNotFoundError: java.lang.ClassNotFoundException: com.google.android.apps.messaging.ui.ConversationMessageView
09-29 00:21:28.927 E/Xposed ( 4465): at de.robv.android.xposed.XposedHelpers.findClass(XposedHelpers.java:62)
09-29 00:21:28.927 E/Xposed ( 4465): at com.xposed.florian.messengermod.XposedModSendTimestamp.handleLoadPackage(XposedModSendTimestamp.java:17)
09-29 00:21:28.927 E/Xposed ( 4465): at de.robv.android.xposed.IXposedHookLoadPackage$Wrapper.handleLoadPackage(IXposedHookLoadPackage.java:34)
09-29 00:21:28.927 E/Xposed ( 4465): at de.robv.android.xposed.callbacks.XC_LoadPackage.call(XC_LoadPackage.java:61)
09-29 00:21:28.927 E/Xposed ( 4465): at de.robv.android.xposed.callbacks.XCallback.callAll(XCallback.java:106)
09-29 00:21:28.927 E/Xposed ( 4465): at de.robv.android.xposed.XposedBridge$1.beforeHookedMethod(XposedBridge.java:193)
09-29 00:21:28.927 E/Xposed ( 4465): at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:720)
09-29 00:21:28.927 E/Xposed ( 4465): at android.app.ActivityThread.handleBindApplication(<Xposed>)
09-29 00:21:28.927 E/Xposed ( 4465): at android.app.ActivityThread.access$1600(ActivityThread.java:159)
09-29 00:21:28.927 E/Xposed ( 4465): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1445)
09-29 00:21:28.927 E/Xposed ( 4465): at android.os.Handler.dispatchMessage(Handler.java:102)
09-29 00:21:28.927 E/Xposed ( 4465): at android.os.Looper.loop(Looper.java:152)
09-29 00:21:28.927 E/Xposed ( 4465): at android.app.ActivityThread.main(ActivityThread.java:5507)
09-29 00:21:28.927 E/Xposed ( 4465): at java.lang.reflect.Method.invoke(Native Method)
09-29 00:21:28.927 E/Xposed ( 4465): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
09-29 00:21:28.927 E/Xposed ( 4465): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
09-29 00:21:28.927 E/Xposed ( 4465): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
09-29 00:21:28.927 E/Xposed ( 4465): Caused by: java.lang.ClassNotFoundException: com.google.android.apps.messaging.ui.ConversationMessageView
09-29 00:21:28.927 E/Xposed ( 4465): at java.lang.Class.classForName(Native Method)
09-29 00:21:28.927 E/Xposed ( 4465): at java.lang.Class.forName(Class.java:324)
09-29 00:21:28.927 E/Xposed ( 4465): at external.org.apache.commons.lang3.ClassUtils.getClass(ClassUtils.java:823)
09-29 00:21:28.927 E/Xposed ( 4465): at de.robv.android.xposed.XposedHelpers.findClass(XposedHelpers.java:60)
09-29 00:21:28.927 E/Xposed ( 4465): ... 16 more
09-29 00:21:28.927 E/Xposed ( 4465): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.apps.messaging.ui.ConversationMessageView" on path: DexPathList[[zip file "/data/app/com.google.android.apps.messaging-1/base.apk"],nativeLibraryDirectories=[/data/app/com.google.android.apps.messaging-1/lib/arm64, /data/app/com.google.android.apps.messaging-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]
09-29 00:21:28.927 E/Xposed ( 4465): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
09-29 00:21:28.927 E/Xposed ( 4465): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
09-29 00:21:28.927 E/Xposed ( 4465): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
09-29 00:21:28.927 E/Xposed ( 4465): ... 20 more
09-29 00:21:28.927 E/Xposed ( 4465): Suppressed: java.lang.ClassNotFoundException: com.google.android.apps.messaging.ui.ConversationMessageView
09-29 00:21:28.927 E/Xposed ( 4465): at java.lang.Class.classForName(Native Method)
09-29 00:21:28.927 E/Xposed ( 4465): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
09-29 00:21:28.927 E/Xposed ( 4465): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
09-29 00:21:28.927 E/Xposed ( 4465): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
09-29 00:21:28.927 E/Xposed ( 4465): ... 21 more
09-29 00:21:28.927 E/Xposed ( 4465): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
我如何获取字段
var request = new OAuth2Request("GET", new Uri("https://graph.facebook.com/me?fields=email,first_name,last_name,gender,picture"), null, eventArgs.Account);