7

我是使用https://parse.com/docs/server/guide作为指南从 Parse 迁移到 Heroku(带 MongoLab 沙箱)的众多用户之一。

迁移进展顺利(可以通过远程仓库上的 REST 命令创建/检索对象),直到我尝试使用(iOS)Facebook 登录。

方法:

[PFFacebookUtils logInInBackgroundWithReadPermissions: ... ]

在 Parse 托管时一直在工作,现在返回以下错误:

[Error]: Facebook auth is invalid for this user. (Code: 101, Version: 1.12.0)

注意:对我(以前工作的)iOS 代码的唯一更改是将 Parse 服务器指向我新的手动托管的存储库,如下所示:

 let parseConfiguration = ParseClientConfiguration(block: { (ParseMutableClientConfiguration) -> Void in
        ParseMutableClientConfiguration.applicationId = "<*APP ID*>"
        ParseMutableClientConfiguration.clientKey = "<*CLIENT KEY*>"
        ParseMutableClientConfiguration.server = "https://<*HEROKU APP ID*>.herokuapp.com/parse"
    })

 Parse.initializeWithConfiguration(parseConfiguration) 

& 对开源 Parse Server 代码 ( https://github.com/ParsePlatform/parse-server-example ) 的唯一修改是替换配置以匹配我的 Parse / mongo 标识:

var api = new ParseServer({
  databaseURI:     'mongodb://<*UNIUQUE ID*>' || 'mongodb://localhost:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: '<*PARSE APP ID*>',
  masterKey: '<*PARSE MASTER KEY*>'
});
4

3 回答 3

9

您需要添加包含有效 facebook 应用程序 ID 数组的键 facebookAppIds,这文档中提到。

或者,添加 FACEBOOK_APP_ID 键作为引用 [这里] ( https://github.com/ParsePlatform/parse-server/issues/82 )

于 2016-01-31T08:07:09.263 回答
3

我不知道你是否已经拥有或尝试过这个,但我和你的情况非常相似,为我解决的问题是:

AppDelegate.swift中,ParseClientConfiguration必须在 Parse Facebook Utils 初始化之前didFinishLaunchingWithOptions初始化:

...

// *** Initialize Parse. ***
let config = ParseClientConfiguration(block: {
    (ParseMutableClientConfiguration) -> Void in
    ParseMutableClientConfiguration.applicationId = appKey;
    ParseMutableClientConfiguration.clientKey = clientKey;
    ParseMutableClientConfiguration.server = serverURL;
});

Parse.initializeWithConfiguration(config);

// *NOTE: Putting the following line after after Parse.initializeWithConfiguration(config) fixed the issue
// After this change, the user is no longer nil and does not print "Uh oh. The user cancelled the Facebook login.". Instead, it executes the `if let user = user` block
PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)

...

希望这至少对某人有所帮助!

于 2016-07-05T20:52:25.040 回答
0

我在 Back4app 中运行的 Parse Server 上遇到了同样的问题。解决方案是在 Back4app 平台上添加 Facebook App Id。

于 2017-03-11T01:22:34.523 回答