[英]Get App access token with Facebook iOS SDK
I am trying to get an Facebook App access token to get the Facebook page feed. 我正在尝试获取Facebook App访问令牌以获取Facebook页面供稿。 If I send a request like this:
[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=client_credentials"]
I get a valid access token but I can't use this one in the FBSession because the accessToken property is read-only. 如果我发送这样的请求:
[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=client_credentials"]
我可以获得有效的访问令牌,但是我可以请勿在FBSession中使用此选项,因为accessToken属性是只读的。 So the question is: how do I obtain an Facebook App access token with FBSession? 所以问题是:如何通过FBSession获取Facebook App访问令牌?
If you successfully login then you can get accesstoken using 如果您成功登录,则可以使用
[[FBSession activeSession] accessToken];
Thanks. 谢谢。
Check out the Scrumptious sample, along with the other stuff Facebook has provided. 查看Scrumptious示例以及Facebook提供的其他内容。
I did mine like: 我确实是这样的:
[FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:YES completionHandler: ^(FBSession *session, FBSessionState state, NSError *error) { [self sessionStateChanged:session state:state error:error]; }];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.