"AuthenticatedUser" not assigned after login iOS/swift

Client SDK iOS/swift

App ID: 0A712AC8-04AB-0261-FF80-964B643D3000

Expected Behavior

  1. User logs in
  2. User role should be set to “AuthenticatedUser”

Actual Behavior

  1. User logs in
  2. Still shows “NotAuthenticatedUser” when I print “Backendless.shared.userService.getUserRoles”
  3. Result is the user can’t access anything restricted to AuthenticatedUser

The user token IS valid …just seems like the AuthenticatedUser isn’t set

Hi, @David_Thompson

In order to help us understand your issue, please provide us with a simple code snippet that reproduces it. Our IOS developer will look into the problem.

Regards,
Marina

Here is the code I’m using to test:

Button("Sign In") {
                    Backendless.shared.initApp(applicationId: K.BE.applicationID, apiKey: K.BE.apiKey)
                    Backendless.shared.userService.login(identity: self.email, password: self.password, responseHandler: { loggedInUser in
                        profile.beUser = loggedInUser
                        print("User has been logged in: \(profile.beUser!.objectId ?? "none")")
                        print("\(loggedInUser)")
                        print("Token: " + (Backendless.shared.userService.getUserToken() ?? "NONE"))
                        Backendless.shared.userService.isValidUserToken { isValid in
                            if isValid {
                                print("User Token is Valid")
                                Backendless.shared.userService.getUserRoles { roles in
                                    for role in roles {
                                        print(role)
                                    }
                                } errorHandler: { fault in
                                    print(fault)
                                }

                            }
                        } errorHandler: { fault in
                            print("\(fault)")
                        }
                        self.loginSuccessful.toggle()
                    }, errorHandler: { fault in
                        print("Error: \(fault.message ?? "")")
                    })
                    
                }

The output I get is this:

User has been logged in: D2AFCC66-0B9B-40C8-867B-F746ABA9EDC7
<Backendless.BackendlessUser: 0x600003081cb0>
Token: 0E2BBC38-876C-4F5A-98DD-851F18CF25F9
User Token is Valid
IOSUser
NotAuthenticatedUser

But I’m assuming after a successful login it should be an AuthenticatedUser

Hi, @David_Thompson

We were able to reproduce the issue. An internal ticket has been created - BKNDLSS-30444. Our developer is already looking to the issue.

Regards,
Marina

Hello @David_Thompson,

A new version of Swift-SDK is released (v6.7.2). Please update and verify whether it’s ok now.

Regards,
Olha

I updated and the “AuthenticatedUser” role is properly being assigned (thank you), but now it errors out with this:

Error: User has no permissions for specified resource

Doesn’t matter if I give explicit permissions to the folder or if I reset to “all gray”.

Unfortuanately, I cannot reproduce the permissions issue. Could you please provide a code sample that reproduces this error?