在Firebase SDK v3中使用数据库秘密进行身份validation?

首先,我喜欢新的Firebase。 不过,我无法让我的Swift项目连接到Firebase,因为我正在使用数据库秘密来validation设备。

在Firebase SDK第3版之前,我可以使用Firebase秘密(现在是数据库机密)进行身份validation以访问我的数据库。 我能够使用下面的代码块来做到这一点:

ref.authWithCustomToken("authKeyHere", withCompletionBlock: { error, authData in if error != nil { print("Login failed! \(error)") } else { print("Login to firebase succeeded! \(authData)") } }) 

这对我很好,因为我只是authentication我的应用程序的用户,并没有公开整个数据库,可以这么说。

我试图用新的Firebase SDK(v3)实现同样的function。 我已经添加了必要的豆荚到我的项目,据我所见,我需要使用下面的代码来实现同样的事情:

  FIRApp.configure() FIRAuth.auth()?.signInWithCustomToken("authKeyHere") { (user, error) in //This signs in using the authentication secret so we can now access the database. if error != nil { print(error?.localizedDescription) } else { print(user?.uid) } } 

但是,运行此代码时,我得到的是以下错误打印到日志:

自定义标记格式不正确。 请检查文档。

所以我的问题是:我做错了什么? 如果你需要更多的信息,我很高兴给你:)