Facebook 授权访问令牌?
我正在使用教程代码...
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.facebook.android.*;
import com.facebook.android.Facebook.*;
public class FacebookSSO extends Activity {
Facebook facebook = new Facebook("ID");
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
facebook.authorize(this,new String[] { "offline_access", "publish_stream", "email" },
new DialogListener() {
@Override
public void onComplete(Bundle values) {}
@Override
public void onFacebookError(FacebookError error) {}
@Override
public void onError(DialogError e) {}
@Override
public void onCancel() {}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
facebook.authorizeCallback(requestCode, resultCode, data);
}
}
我想知道...一旦用户通过身份验证,我将如何存储访问令牌?在教程上看不到任何提及。
I'm using the tutorial code...
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.facebook.android.*;
import com.facebook.android.Facebook.*;
public class FacebookSSO extends Activity {
Facebook facebook = new Facebook("ID");
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
facebook.authorize(this,new String[] { "offline_access", "publish_stream", "email" },
new DialogListener() {
@Override
public void onComplete(Bundle values) {}
@Override
public void onFacebookError(FacebookError error) {}
@Override
public void onError(DialogError e) {}
@Override
public void onCancel() {}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
facebook.authorizeCallback(requestCode, resultCode, data);
}
}
I'm wondering... once the user has authenticated how would I store the access token? couldn't see any mention of it on the tutorial.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
即保存在共享首选项中
i.e save it in sharedpreferences
供参考。自 Facebook SDK 3 起,facebook.authorize 已弃用
FYI. facebook.authorize had deprecated since Facebook SDK 3
尝试用这种方法
Try in this way