尝试使用Parse PFFacebookUtils使用Facebook登录时出现错误307 [英] Getting Error 307 when trying to login with Facebook using Parse PFFacebookUtils

查看:156
本文介绍了尝试使用Parse PFFacebookUtils使用Facebook登录时出现错误307的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Parse.com的PFFacebookUtilsV4使用Facebook登录。我使用他们的标准:

I'm trying to log in with Facebook using Parse.com's PFFacebookUtilsV4. I'm using their standard:

 PFFacebookUtils.logInInBackgroundWithReadPermissions(["public_profile"])

{(用户,错误)在

当我将FB帐户连接到我的iPhone在我的iPhone的设置。每次都会出现代码307(如下所示)的错误。如果我从iPhone的设置中删除了FB / iPhone帐户连接,则错误消失,并发生标准认证。我在手机上测试我的手机上有FB应用程序,但似乎并不影响错误。只需通过我的iPhone的设置连接。

When I have connected my FB account to my iPhone in my iPhone's settings. I get an error with code 307 (shown below) every time. If I delete the FB/iPhone account connection from my iPhone's settings, the error goes away and the standard authentication happens. I'm testing on my phone. I have the FB app on my phone, but that doesn't seem to affect the error. Just having it connected via my iPhone's settings.

推荐答案

为了防万一有任何其他错误与Facebook登录解析这里是我学到的

Just in case anyone has any other errors with login with Facebook on parse here's what I learnt

将此键添加到您的解析服务器面板FACEBOOK_APP_ID(在您添加MASTER_KEY附近)

Add this key to your parse server dashboard FACEBOOK_APP_ID (near where you add MASTER_KEY)

您将不得不从以下方法切换

You will have to switch up from the following method

[PFFacebookUtils logInWithPermissions:permissionsArray block:^(PFUser *user, NSError *error) {

首先执行标准的Facebook获取标记

to first executing the standard Facebook get token

FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithReadPermissions: @[@"public_profile"]
             fromViewController:self
                        handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
     if (error) {       
         NSLog(@"Process error");       
     } else if (result.isCancelled) {     
         NSLog(@"Cancelled");     
     } else {   
         NSLog(@"Logged in");

         NSString *facebookUserId   = [FBSDKAccessToken currentAccessToken].userID;
         NSString *accessToken      = [FBSDKAccessToken currentAccessToken].tokenString;
         NSDate *expirationDate     = [FBSDKAccessToken currentAccessToken].expirationDate;

         [self loginFacebookUserWithTokenInfo:facebookUserId
                                  accessToken:accessToken
                               expirationDate:expirationDate];
     }
 }];

然后您使用以下代码段登录

Then you login using the following section of code

[PFFacebookUtils logInWithFacebookId:facebookId
                         accessToken:accessToken
                      expirationDate:expirationDate
                               block:^(PFUser *user, NSError *error) {

                                       if (error) {             
                                           NSLog(@"Error!");
                                       } else {
                                           NSLog(@"User logged in through Facebook and parse!");
                                           // do as you please
                                       }
                                   }];

这篇关于尝试使用Parse PFFacebookUtils使用Facebook登录时出现错误307的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆