解析服务器上不支持匿名登录(由Azure托管)?

时间:2017-01-29 00:52:18

标签: ios swift azure parse-server

我最近将我的iOS应用程序从Parse迁移到Azure上托管的Parse Server。除了我使用PFAnonymousUtils登录匿名用户时出现此错误,所有内容似乎都按预期工作:

[Error]: This authentication method is unsupported. (Code: 252, Version: 1.14.2)
Optional(Error Domain=Parse Code=252 "This authentication method is unsupported." 
UserInfo={code=252, temporary=0, error=This authentication method is unsupported., 
NSLocalizedDescription=This authentication method is unsupported.})

以下是我在AppDelegate中使用的登录顺序(didFinishLaunchingWith Options):

        let configuration = ParseClientConfiguration {
            $0.applicationId = "my-awesome-app-id"
            $0.server = "https://awesomeapp.azurewebsites.net/parse/"
        }

        Parse.initialize(with: configuration)
        let currentUser = PFUser.current()

        if currentUser == nil {
            PFAnonymousUtils.logIn {
                (user: PFUser?, error: Error?) -> Void in
                if error != nil || user == nil {
                    //See error above
                    print(error)
                } else {
                    user?.saveInBackground()
                }
            }
        }

我知道Parse Server支持匿名用户,这就是我觉得这个错误令人困惑的原因。我是否有可能在Azure上更改我的Parse Server上的配置?

1 个答案:

答案 0 :(得分:2)

是的,您需要确保在parse-server配置中将enableAnonymousUsers设置为true。

https://github.com/mamaso/parse-server-azure-config/blob/master/index.js