OStack程序员社区-中国程序员成长平台

标题: ios - 使用Facebook访问 token 登录的Quickblox iOS SDK无法正常工作 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 09:50
标题: ios - 使用Facebook访问 token 登录的Quickblox iOS SDK无法正常工作

我正在使用最新的Quickblox 2.3.0.4

我无法使用Facebook访问 token 登录。

[QBRequest logInWithSocialProvider"facebook" accessToken:[FBSDKAccessToken currentAccessToken].tokenString accessTokenSecret:nil successBlock:^(QBResponse *response, QBUUser *user) {
    NSLog(@"qb login succeed");
} errorBlock:^(QBResponse *response) {
    NSLog(@"qb login failed"); //it hits this
}];

响应头:
Response headers: {
   "Access-Control-Allow-Origin" = "*";
   "Cache-Control" = "no-cache";
    Connection = "keep-alive";
   "Content-Length" = 32;
   "Content-Type" = "application/json; charset=utf-8";
    Date = "Wed, 12 Aug 2015 16:54:47 GMT";
   "QuickBlox-REST-API-Version" = "0.1.1";
   Server = "nginx/1.0.15";
   Status = "401 Unauthorized";
   "X-Rack-Cache" = "invalidate, pass";
   "X-Request-Id" = 607e9709265a701be551a3eea7d4610a;
   "X-Runtime" = "0.003635";
   "X-UA-Compatible" = "IE=Edge,chrome=1";
}

我使用图形API:https://graph.facebook.com/me?access_token=测试了访问 token ,并显示了有效信息。



Best Answer-推荐答案


基于Quickblox docs:

为了使用QuickBlox用户API(任何QuickBlox API),您必须创建 session 。

试试这个:

// Create session request
[QBRequest createSessionWithSuccessBlock:^(QBResponse *response, QBASession *session) {
    //Your Quickblox session was created successfully
    [QBRequest logInWithSocialProvider"facebook" accessToken:[FBSDKAccessToken currentAccessToken].tokenString accessTokenSecret:nil successBlock:^(QBResponse *response, QBUUser *user) {
        NSLog(@"qb login succeed");
    } errorBlock:^(QBResponse *response) {
        NSLog(@"qb login failed");
    }];
} errorBlock:^(QBResponse *response) {
    //Handle error here
}];

关于ios - 使用Facebook访问 token 登录的Quickblox iOS SDK无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31971397/






欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) Powered by Discuz! X3.4