简体   繁体   中英

Anonymous login unsupported on Parse Server (hosted by Azure)?

I recently migrated my iOS application from Parse to a Parse Server hosted on Azure. Everything appears to be working as expected except that I get this error when I use PFAnonymousUtils to log in an Anonymous user:

 [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.}) 

Here is the login sequence I am using in the 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()
                }
            }
        }

I know that Anonymous Users are supported in Parse Server, which is why I find this error baffling. Is it possible that I need to change a configuration on my Parse Server on Azure?

Yes you need to ensure enableAnonymousUsers is set to true in parse-server config.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM